refactor: init cypress-cucumber-preprocessor install.
This commit is contained in:
33
node_modules/browser-pack/test/comment.js
generated
vendored
Normal file
33
node_modules/browser-pack/test/comment.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('trailing comment', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.throws(function() {
|
||||
r('zzz');
|
||||
}, /Cannot find module 'zzz'/);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true); module.exports=function(n){return n*111}'
|
||||
+ ' // trailing comment'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
33
node_modules/browser-pack/test/empty.js
generated
vendored
Normal file
33
node_modules/browser-pack/test/empty.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
var vm = require('vm');
|
||||
|
||||
test('empty', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
t.doesNotThrow(function() {
|
||||
vm.runInNewContext(src, {});
|
||||
});
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
||||
|
||||
test('empty with standalone', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack({standalone: 'ABC'});
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
t.doesNotThrow(function() {
|
||||
vm.runInNewContext(src, {});
|
||||
});
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
34
node_modules/browser-pack/test/not_found.js
generated
vendored
Normal file
34
node_modules/browser-pack/test/not_found.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
var concat = require('concat-stream');
|
||||
|
||||
test('not found', function (t) {
|
||||
t.plan(6);
|
||||
|
||||
var p = pack({ raw: true, hasExports: true });
|
||||
var src = '';
|
||||
p.pipe(concat(function (src) {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.throws(function() {
|
||||
r('zzz');
|
||||
}, /Cannot find module 'zzz'/);
|
||||
try { r('zzz') }
|
||||
catch (err) { t.equal(err.code, 'MODULE_NOT_FOUND') }
|
||||
}));
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true); module.exports=function(n){return n*111}'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
26
node_modules/browser-pack/test/only_execute_entries.js
generated
vendored
Normal file
26
node_modules/browser-pack/test/only_execute_entries.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('raw', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'T.ok(true)',
|
||||
entry: true,
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'T.fail("non-entry files should not execute")'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
38
node_modules/browser-pack/test/order.js
generated
vendored
Normal file
38
node_modules/browser-pack/test/order.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('raw', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var order = [];
|
||||
var r = Function(['order'], 'return ' + src)(order);
|
||||
t.same(order, [ 'abc', 'def', 'hij' ]);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'def',
|
||||
order: 1,
|
||||
entry: true,
|
||||
source: 'order.push("def")'
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'hij',
|
||||
entry: true,
|
||||
order: 2,
|
||||
source: 'order.push("hij")'
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
entry: true,
|
||||
order: 0,
|
||||
source: 'order.push("abc")'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
28
node_modules/browser-pack/test/pack.js
generated
vendored
Normal file
28
node_modules/browser-pack/test/pack.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('pack', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true); module.exports=function(n){return n*111}'
|
||||
}
|
||||
]));
|
||||
});
|
32
node_modules/browser-pack/test/raw.js
generated
vendored
Normal file
32
node_modules/browser-pack/test/raw.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('raw', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.throws(function() {
|
||||
r('zzz');
|
||||
}, /Cannot find module 'zzz'/);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true); module.exports=function(n){return n*111}'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
59
node_modules/browser-pack/test/source-maps-existing.js
generated
vendored
Normal file
59
node_modules/browser-pack/test/source-maps-existing.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
var convert = require('convert-source-map');
|
||||
var parse = require('parse-base64vlq-mappings');
|
||||
|
||||
var foo = {
|
||||
version: 3,
|
||||
file: 'foo.js',
|
||||
sourceRoot: '',
|
||||
sources: [ 'foo.coffee' ],
|
||||
names: [],
|
||||
mappings: ';AAAA;CAAA;CAAA,CAAA,CAAA,IAAO,GAAK;CAAZ',
|
||||
sourcesContent: [ 'console.log(require \'./bar.js\')\n' ] };
|
||||
|
||||
test('pack one file with source file field and existing sourcemap', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var mapComment = convert.fromObject(foo).toComment();
|
||||
var fooMappings = parse(foo.mappings);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
|
||||
var sm = convert.fromSource(src).toObject();
|
||||
var mappings = parse(sm.mappings);
|
||||
|
||||
var remainingMaps = src.match(convert.commentRegex);
|
||||
|
||||
// remove map for _prelude.js
|
||||
mappings.shift();
|
||||
|
||||
var fstMap = mappings[0];
|
||||
var fstFooMap = fooMappings[0];
|
||||
var lstMap = mappings.pop();
|
||||
var lstFooMap = fooMappings.pop();
|
||||
|
||||
t.deepEqual(fstMap.original, fstFooMap.original, 'first original mappings are same');
|
||||
t.deepEqual(lstMap.original, lstFooMap.original, 'last original mappings are same');
|
||||
|
||||
t.equal(fstMap.generated.column, fstFooMap.generated.column, 'first generated columns are same');
|
||||
t.equal(lstMap.generated.column, lstFooMap.generated.column, 'last generated columns are same');
|
||||
|
||||
t.equal(fstMap.generated.line, fstFooMap.generated.line + 1, 'first generated line is offset by 1');
|
||||
t.equal(lstMap.generated.line, lstFooMap.generated.line + 1, 'last generated line is offset by 1');
|
||||
|
||||
t.equal(remainingMaps.length, 1, 'removes orinal source maps');
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'xyz',
|
||||
source: '(function() {\n\n console.log(require(\'./bar.js\'));\n\n}).call(this);\n' + '\n' + mapComment,
|
||||
sourceFile: 'foo.js'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
221
node_modules/browser-pack/test/source-maps.js
generated
vendored
Normal file
221
node_modules/browser-pack/test/source-maps.js
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
var path = require('path');
|
||||
|
||||
function decode(base64) {
|
||||
return new Buffer(base64, 'base64').toString();
|
||||
}
|
||||
|
||||
function unmountPrelude(sources) {
|
||||
return sources.map(function (x) {
|
||||
var basename = path.basename(x);
|
||||
return basename === '_prelude.js' ? basename : x;
|
||||
});
|
||||
}
|
||||
|
||||
function grabSourceMap(lastLine) {
|
||||
var base64 = lastLine.split(',').pop();
|
||||
var sm = JSON.parse(decode(base64));
|
||||
sm.sources = unmountPrelude(sm.sources);
|
||||
return sm;
|
||||
}
|
||||
|
||||
function grabLastLine(src) {
|
||||
return src.split('\n').slice(-2)[0];
|
||||
}
|
||||
|
||||
test('pack one file with source file field and one without', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
var sm = grabSourceMap(lastLine);
|
||||
|
||||
t.ok(/^\/\/# sourceMappingURL/.test(lastLine), 'contains source mapping url as last line');
|
||||
t.deepEqual(sm.sources, [ '_prelude.js', 'foo.js' ], 'includes mappings for sourceFile and prelude only');
|
||||
t.equal(sm.mappings, 'AAAA;;;ACAA;AACA;AACA;AACA', 'adds offset mapping for each line' );
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
|
||||
sourceFile: 'foo.js'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
test('pack two files with source file field', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
var sm = grabSourceMap(lastLine);
|
||||
|
||||
t.ok(/^\/\/# sourceMappingURL/.test(lastLine), 'contains source mapping url as last line');
|
||||
t.deepEqual(sm.sources, [ '_prelude.js', 'wunder/bar.js', 'foo.js' ], 'includes mappings for both files and prelude');
|
||||
t.equal(sm.mappings, 'AAAA;ACAA;;ACAA;AACA;AACA;AACA', 'adds offset mapping for each line' );
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' },
|
||||
sourceFile: 'wunder/bar.js'
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
|
||||
sourceFile: 'foo.js'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
test('pack two files without source file field', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
t.notOk(/^\/\/# sourceMappingURL/.test(lastLine), 'contains no source mapping url');
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
test('pack two files with source file field, one with nomap flag', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
var sm = grabSourceMap(lastLine);
|
||||
|
||||
t.ok(/^\/\/# sourceMappingURL/.test(lastLine), 'contains source mapping url as last line');
|
||||
t.deepEqual(sm.sources, [ '_prelude.js', 'wunder/bar.js' ], 'includes mappings for only the file without the "nomap" flag and prelude');
|
||||
t.equal(sm.mappings, 'AAAA;ACAA', 'adds offset mapping for each line of mapped file' );
|
||||
t.end()
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' },
|
||||
sourceFile: 'wunder/bar.js'
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
|
||||
sourceFile: 'foo.js',
|
||||
nomap: true
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
test('custom sourceMapPrefix for //@', function (t) {
|
||||
t.plan(7);
|
||||
|
||||
var p = pack({ sourceMapPrefix: '//@' });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['T'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
|
||||
var lastLine = grabLastLine(src);
|
||||
var sm = grabSourceMap(lastLine);
|
||||
|
||||
t.ok(/^\/\/@ sourceMappingURL/.test(lastLine), 'contains source mapping url as last line');
|
||||
t.deepEqual(sm.sources, [ '_prelude.js', 'foo.js' ], 'includes mappings for sourceFile and prelude only');
|
||||
t.equal(sm.mappings, 'AAAA;;;ACAA;AACA;AACA;AACA', 'adds offset mapping for each line' );
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
|
||||
sourceFile: 'foo.js'
|
||||
}
|
||||
]));
|
||||
});
|
||||
|
||||
test('custom sourceRoot', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack({ sourceRoot: '/custom-root' });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var lastLine = grabLastLine(src);
|
||||
var sm = grabSourceMap(lastLine);
|
||||
t.equal(sm.sourceRoot, '/custom-root', 'sets a custom source root' );
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([
|
||||
{
|
||||
id: 'abc',
|
||||
source: 'T.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
},
|
||||
{
|
||||
id: 'xyz',
|
||||
source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
|
||||
sourceFile: 'foo.js'
|
||||
}
|
||||
]));
|
||||
});
|
24
node_modules/browser-pack/test/this.js
generated
vendored
Normal file
24
node_modules/browser-pack/test/this.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* In node.js `this` on the module root is the same as `exports`. Browser-pack
|
||||
* should act like it too.
|
||||
**/
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('this', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var p = pack();
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf; });
|
||||
p.on('end', function () {
|
||||
var r = Function([], 'return ' + src)();
|
||||
t.deepEqual(r("abc"), { foo: "bar" });
|
||||
});
|
||||
|
||||
p.end(JSON.stringify([{
|
||||
id: 'abc',
|
||||
source: 'this.foo = "bar"'
|
||||
}]));
|
||||
|
||||
});
|
32
node_modules/browser-pack/test/unicode.js
generated
vendored
Normal file
32
node_modules/browser-pack/test/unicode.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var test = require('tap').test;
|
||||
var pack = require('../');
|
||||
|
||||
test('unicode', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var p = pack({ raw: true });
|
||||
var src = '';
|
||||
p.on('data', function (buf) { src += buf });
|
||||
p.on('end', function () {
|
||||
var r = Function(['Ṫ'], 'return ' + src)(t);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.equal(r('xyz')(5), 555);
|
||||
t.throws(function() {
|
||||
r('zzz');
|
||||
}, /Cannot find module 'zzz'/);
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'abc',
|
||||
source: 'Ṫ.equal(require("./xyz")(3), 333)',
|
||||
entry: true,
|
||||
deps: { './xyz': 'xyz' }
|
||||
});
|
||||
|
||||
p.write({
|
||||
id: 'xyz',
|
||||
source: 'Ṫ.ok(true); module.exports=function(ñ){return ñ*111}'
|
||||
});
|
||||
|
||||
p.end();
|
||||
});
|
Reference in New Issue
Block a user