var browserify = require('../'); var test = require('tap').test; var vm = require('vm'); test('ignore', function (t) { t.plan(1); var b = browserify(); b.add(__dirname + '/ignore/main.js'); b.ignore( __dirname + '/ignore/skip.js'); b.bundle(function (err, src) { if (err) t.fail(err); vm.runInNewContext(src, { t: t }); }); }); test('ignore by package or id', function (t) { t.plan(3); var b = browserify(); b.add(__dirname + '/ignore/by-id.js'); b.ignore('events'); b.ignore('beep'); b.ignore('bad id'); b.bundle(function (err, src) { if (err) t.fail(err); vm.runInNewContext(src, { t: t }); }); }); test('ignore files referenced by relative path', function (t) { // Change the current working directory relative to this file var cwd = process.cwd(); process.chdir(__dirname); t.plan(1); var b = browserify(); b.add(__dirname + '/ignore/by-relative.js'); b.ignore('./ignore/ignored/skip.js'); b.bundle(function (err, src) { if (err) t.fail(err); vm.runInNewContext(src, { t: t }); }); // Revert CWD process.chdir(cwd); }); test('do not ignore files with relative paths that do not resolve', function (t) { // Change the current working directory to the ignore folder var cwd = process.cwd(); process.chdir(__dirname + '/ignore'); t.plan(2); var b = browserify(); b.add(__dirname + '/ignore/double-skip.js'); b.ignore('./skip.js'); b.bundle(function (err, src) { if (err) t.fail(err); vm.runInNewContext(src, { t: t }); }); // Revert CWD process.chdir(cwd); });
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 19553 | swellard | Move and rename clients | ||
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/javascript/node_modules/browserify/test/ignore.js | |||||
#1 | 18810 | tjuricek |
First-pass at JavaScript client SDK. JavaScript requires Node with Gulp to "browserfy" the library. It's the easiest way I found to use the swagger-js project; bundle up a wrapping method. There is no JavaScript reference guide. The swagger-js doesn't really document what they do very well, actually. Overall I'm not particularly impressed by swagger-js, it was hard to even figure out what the right method syntax was. We may want to invest time in doing it better. This required setting CORS response headers, which are currently defaulted to a fairly insecure setting. |