Skip to content

Commit

Permalink
Add test for checking bootcode dependencies on browser
Browse files Browse the repository at this point in the history
  • Loading branch information
appurva21 committed Aug 29, 2024
1 parent 37ed816 commit 4f4d73e
Showing 1 changed file with 259 additions and 130 deletions.
389 changes: 259 additions & 130 deletions test/system/bootcode-dependencies.test.js
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();
});
});
});

0 comments on commit 4f4d73e

Please sign in to comment.