-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for checking bootcode dependencies on browser
- Loading branch information
Showing
1 changed file
with
259 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,139 +1,268 @@ | ||
describe('bootcode dependencies', function () { | ||
this.timeout(60 * 1000); | ||
const expect = require('chai').expect, | ||
env = require('../../lib/environment'), | ||
Bundle = require('../../lib/bundle'), | ||
|
||
var expect = require('chai').expect, | ||
env = require('../../lib/environment'), | ||
Bundle = require('../../lib/bundle'), | ||
currentDependencies; | ||
expectedDependenciesBrowser = [ | ||
'@faker-js/faker', | ||
'@postman/tough-cookie', | ||
'ajv', | ||
'array-filter', | ||
'assert', | ||
'assertion-error', | ||
'atob', | ||
'available-typed-arrays', | ||
'backbone', | ||
'base64-js', | ||
'boolbase', | ||
'browserify', | ||
'btoa', | ||
'buffer', | ||
'call-bind', | ||
'chai', | ||
'chai-postman', | ||
'charset', | ||
'check-error', | ||
'cheerio', | ||
'core-util-is', | ||
'crypto-js', | ||
'css-select', | ||
'css-what', | ||
'csv-parse', | ||
'deep-eql', | ||
'define-properties', | ||
'dom-serializer', | ||
'domelementtype', | ||
'domhandler', | ||
'domutils', | ||
'entities', | ||
'es-abstract', | ||
'es6-object-assign', | ||
'events', | ||
'fast-deep-equal', | ||
'fast-json-stable-stringify', | ||
'file-type', | ||
'foreach', | ||
'function-bind', | ||
'get-func-name', | ||
'get-intrinsic', | ||
'has', | ||
'has-symbols', | ||
'htmlparser2', | ||
'http-reasons', | ||
'iconv-lite', | ||
'ieee754', | ||
'inherits', | ||
'is-arguments', | ||
'is-buffer', | ||
'is-generator-function', | ||
'is-nan', | ||
'is-typed-array', | ||
'isarray', | ||
'jquery', | ||
'json-schema-traverse', | ||
'liquid-json', | ||
'lodash', | ||
'lodash.assignin', | ||
'lodash.bind', | ||
'lodash.defaults', | ||
'lodash.filter', | ||
'lodash.flatten', | ||
'lodash.foreach', | ||
'lodash.map', | ||
'lodash.merge', | ||
'lodash.pick', | ||
'lodash.reduce', | ||
'lodash.reject', | ||
'lodash.some', | ||
'lodash3', | ||
'loupe', | ||
'mime-db', | ||
'mime-format', | ||
'mime-types', | ||
'moment', | ||
'nth-check', | ||
'object-is', | ||
'object-keys', | ||
'os-browserify', | ||
'path-browserify', | ||
'pathval', | ||
'postman-collection', | ||
'postman-sandbox', | ||
'postman-url-encoder', | ||
'process', | ||
'process-nextick-args', | ||
'psl', | ||
'punycode', | ||
'querystring-es3', | ||
'querystringify', | ||
'readable-stream', | ||
'requires-port', | ||
'safe-buffer', | ||
'safer-buffer', | ||
'sax', | ||
'semver', | ||
'stream-browserify', | ||
'string_decoder', | ||
'teleport-javascript', | ||
'timers-browserify', | ||
'tv4', | ||
'type-detect', | ||
'underscore', | ||
'uniscope', | ||
'universalify', | ||
'uri-js', | ||
'url', | ||
'url-parse', | ||
'util', | ||
'util-deprecate', | ||
'uuid', | ||
'which-typed-array', | ||
'xml2js', | ||
'xmlbuilder' | ||
], | ||
expectedDependenciesNode = [ | ||
'@faker-js/faker', | ||
'@postman/tough-cookie', | ||
'ajv', | ||
'array-filter', | ||
'assert', | ||
'assertion-error', | ||
'atob', | ||
'available-typed-arrays', | ||
'backbone', | ||
'boolbase', | ||
'browserify', | ||
'btoa', | ||
'call-bind', | ||
'chai', | ||
'chai-postman', | ||
'charset', | ||
'check-error', | ||
'cheerio', | ||
'core-util-is', | ||
'crypto-js', | ||
'css-select', | ||
'css-what', | ||
'csv-parse', | ||
'deep-eql', | ||
'define-properties', | ||
'dom-serializer', | ||
'domelementtype', | ||
'domhandler', | ||
'domutils', | ||
'entities', | ||
'es-abstract', | ||
'es6-object-assign', | ||
'events', | ||
'fast-deep-equal', | ||
'fast-json-stable-stringify', | ||
'file-type', | ||
'foreach', | ||
'function-bind', | ||
'get-func-name', | ||
'get-intrinsic', | ||
'has', | ||
'has-symbols', | ||
'htmlparser2', | ||
'http-reasons', | ||
'iconv-lite', | ||
'inherits', | ||
'is-arguments', | ||
'is-buffer', | ||
'is-generator-function', | ||
'is-nan', | ||
'is-typed-array', | ||
'isarray', | ||
'jquery', | ||
'json-schema-traverse', | ||
'liquid-json', | ||
'lodash', | ||
'lodash.assignin', | ||
'lodash.bind', | ||
'lodash.defaults', | ||
'lodash.filter', | ||
'lodash.flatten', | ||
'lodash.foreach', | ||
'lodash.map', | ||
'lodash.merge', | ||
'lodash.pick', | ||
'lodash.reduce', | ||
'lodash.reject', | ||
'lodash.some', | ||
'lodash3', | ||
'loupe', | ||
'mime-db', | ||
'mime-format', | ||
'mime-types', | ||
'moment', | ||
'nth-check', | ||
'object-is', | ||
'object-keys', | ||
'os-browserify', | ||
'path-browserify', | ||
'pathval', | ||
'postman-collection', | ||
'postman-sandbox', | ||
'postman-url-encoder', | ||
'process', | ||
'process-nextick-args', | ||
'psl', | ||
'punycode', | ||
'querystring-es3', | ||
'querystringify', | ||
'readable-stream', | ||
'requires-port', | ||
'safe-buffer', | ||
'safer-buffer', | ||
'sax', | ||
'semver', | ||
'stream-browserify', | ||
'string_decoder', | ||
'teleport-javascript', | ||
'timers-browserify', | ||
'tv4', | ||
'type-detect', | ||
'underscore', | ||
'uniscope', | ||
'universalify', | ||
'uri-js', | ||
'url', | ||
'url-parse', | ||
'util', | ||
'util-deprecate', | ||
'uuid', | ||
'which-typed-array', | ||
'xml2js', | ||
'xmlbuilder' | ||
]; | ||
|
||
before(function (done) { | ||
process && process.stdout.write(' -- building dependencies, please wait... '); | ||
Bundle.load(env).listDependencies(function (err, dependencies) { | ||
currentDependencies = dependencies; | ||
function getCurrentDependencies (isBrowser, cb) { | ||
Bundle.load({ ...env, preferBrowserResolver: isBrowser }) | ||
.listDependencies(function (err, dependencies) { | ||
console.info(err ? 'failed' : 'done'); | ||
|
||
return done(err); | ||
return cb(err, dependencies); | ||
}); | ||
} | ||
|
||
describe('bootcode dependencies', function () { | ||
this.timeout(60 * 1000); | ||
|
||
it('should not change on Node', function (done) { | ||
getCurrentDependencies(false, function (err, currentDependencies) { | ||
if (err) { return done(err); } | ||
|
||
expect(currentDependencies).to.eql(expectedDependenciesNode); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should not change', function () { | ||
expect(currentDependencies).to.eql([ | ||
'@faker-js/faker', | ||
'@postman/tough-cookie', | ||
'ajv', | ||
'array-filter', | ||
'assert', | ||
'assertion-error', | ||
'atob', | ||
'available-typed-arrays', | ||
'backbone', | ||
'base64-js', | ||
'boolbase', | ||
'browserify', | ||
'btoa', | ||
'buffer', | ||
'call-bind', | ||
'chai', | ||
'chai-postman', | ||
'charset', | ||
'check-error', | ||
'cheerio', | ||
'core-util-is', | ||
'crypto-js', | ||
'css-select', | ||
'css-what', | ||
'csv-parse', | ||
'deep-eql', | ||
'define-properties', | ||
'dom-serializer', | ||
'domelementtype', | ||
'domhandler', | ||
'domutils', | ||
'entities', | ||
'es-abstract', | ||
'es6-object-assign', | ||
'events', | ||
'fast-deep-equal', | ||
'fast-json-stable-stringify', | ||
'file-type', | ||
'foreach', | ||
'function-bind', | ||
'get-func-name', | ||
'get-intrinsic', | ||
'has', | ||
'has-symbols', | ||
'htmlparser2', | ||
'http-reasons', | ||
'iconv-lite', | ||
'ieee754', | ||
'inherits', | ||
'is-arguments', | ||
'is-buffer', | ||
'is-generator-function', | ||
'is-nan', | ||
'is-typed-array', | ||
'isarray', | ||
'jquery', | ||
'json-schema-traverse', | ||
'liquid-json', | ||
'lodash', | ||
'lodash.assignin', | ||
'lodash.bind', | ||
'lodash.defaults', | ||
'lodash.filter', | ||
'lodash.flatten', | ||
'lodash.foreach', | ||
'lodash.map', | ||
'lodash.merge', | ||
'lodash.pick', | ||
'lodash.reduce', | ||
'lodash.reject', | ||
'lodash.some', | ||
'lodash3', | ||
'loupe', | ||
'mime-db', | ||
'mime-format', | ||
'mime-types', | ||
'moment', | ||
'nth-check', | ||
'object-is', | ||
'object-keys', | ||
'os-browserify', | ||
'path-browserify', | ||
'pathval', | ||
'postman-collection', | ||
'postman-sandbox', | ||
'postman-url-encoder', | ||
'process', | ||
'process-nextick-args', | ||
'psl', | ||
'punycode', | ||
'querystring-es3', | ||
'querystringify', | ||
'readable-stream', | ||
'requires-port', | ||
'safe-buffer', | ||
'safer-buffer', | ||
'sax', | ||
'semver', | ||
'stream-browserify', | ||
'string_decoder', | ||
'teleport-javascript', | ||
'timers-browserify', | ||
'tv4', | ||
'type-detect', | ||
'underscore', | ||
'uniscope', | ||
'universalify', | ||
'uri-js', | ||
'url', | ||
'url-parse', | ||
'util', | ||
'util-deprecate', | ||
'uuid', | ||
'which-typed-array', | ||
'xml2js', | ||
'xmlbuilder' | ||
]); | ||
it('should not change on Browser', function (done) { | ||
getCurrentDependencies(true, function (err, currentDependencies) { | ||
if (err) { return done(err); } | ||
|
||
expect(currentDependencies).to.eql(expectedDependenciesBrowser); | ||
done(); | ||
}); | ||
}); | ||
}); |