How to use join method in stryker-parent

Best JavaScript code snippet using stryker-parent

resolver.js

Source:resolver.js Github

copy

Full Screen

2var test = require('tape');3var resolve = require('../');4test('async foo', function (t) {5 t.plan(12);6 var dir = path.join(__dirname, 'resolver');7 resolve('./foo', { basedir: dir }, function (err, res, pkg) {8 if (err) t.fail(err);9 t.equal(res, path.join(dir, 'foo.js'));10 t.equal(pkg && pkg.name, 'resolve');11 });12 resolve('./foo.js', { basedir: dir }, function (err, res, pkg) {13 if (err) t.fail(err);14 t.equal(res, path.join(dir, 'foo.js'));15 t.equal(pkg && pkg.name, 'resolve');16 });17 resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {18 if (err) t.fail(err);19 t.equal(res, path.join(dir, 'foo.js'));20 t.equal(pkg && pkg.main, 'resolver');21 });22 resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {23 if (err) t.fail(err);24 t.equal(res, path.join(dir, 'foo.js'));25 t.equal(pkg.main, 'resolver');26 });27 resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) {28 if (err) t.fail(err);29 t.equal(res, path.join(dir, 'foo.js'));30 });31 resolve('foo', { basedir: dir }, function (err) {32 t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'");33 t.equal(err.code, 'MODULE_NOT_FOUND');34 });35 // Test that filename is reported as the "from" value when passed.36 resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) {37 t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'");38 });39});40test('bar', function (t) {41 t.plan(6);42 var dir = path.join(__dirname, 'resolver');43 resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) {44 if (err) t.fail(err);45 t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));46 t.equal(pkg, undefined);47 });48 resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) {49 if (err) t.fail(err);50 t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));51 t.equal(pkg, undefined);52 });53 resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) {54 if (err) t.fail(err);55 t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));56 t.equal(pkg.main, 'bar');57 });58});59test('baz', function (t) {60 t.plan(4);61 var dir = path.join(__dirname, 'resolver');62 resolve('./baz', { basedir: dir }, function (err, res, pkg) {63 if (err) t.fail(err);64 t.equal(res, path.join(dir, 'baz/quux.js'));65 t.equal(pkg.main, 'quux.js');66 });67 resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {68 if (err) t.fail(err);69 t.equal(res, path.join(dir, 'baz/quux.js'));70 t.equal(pkg.main, 'quux.js');71 });72});73test('biz', function (t) {74 t.plan(24);75 var dir = path.join(__dirname, 'resolver/biz/node_modules');76 resolve('./grux', { basedir: dir }, function (err, res, pkg) {77 if (err) t.fail(err);78 t.equal(res, path.join(dir, 'grux/index.js'));79 t.equal(pkg, undefined);80 });81 resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) {82 if (err) t.fail(err);83 t.equal(res, path.join(dir, 'grux/index.js'));84 t.equal(pkg.main, 'biz');85 });86 resolve('./garply', { basedir: dir }, function (err, res, pkg) {87 if (err) t.fail(err);88 t.equal(res, path.join(dir, 'garply/lib/index.js'));89 t.equal(pkg.main, './lib');90 });91 resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) {92 if (err) t.fail(err);93 t.equal(res, path.join(dir, 'garply/lib/index.js'));94 t.equal(pkg.main, './lib');95 });96 resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) {97 if (err) t.fail(err);98 t.equal(res, path.join(dir, 'tiv/index.js'));99 t.equal(pkg, undefined);100 });101 resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) {102 if (err) t.fail(err);103 t.equal(res, path.join(dir, 'tiv/index.js'));104 t.equal(pkg.main, 'grux');105 });106 resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) {107 if (err) t.fail(err);108 t.equal(res, path.join(dir, 'tiv/index.js'));109 t.equal(pkg, undefined);110 });111 resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) {112 if (err) t.fail(err);113 t.equal(res, path.join(dir, 'tiv/index.js'));114 t.equal(pkg.main, './lib');115 });116 resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) {117 if (err) t.fail(err);118 t.equal(res, path.join(dir, 'grux/index.js'));119 t.equal(pkg, undefined);120 });121 resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) {122 if (err) t.fail(err);123 t.equal(res, path.join(dir, 'grux/index.js'));124 t.equal(pkg.main, 'tiv');125 });126 resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) {127 if (err) t.fail(err);128 t.equal(res, path.join(dir, 'garply/lib/index.js'));129 t.equal(pkg.main, './lib');130 });131 resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) {132 if (err) t.fail(err);133 t.equal(res, path.join(dir, 'garply/lib/index.js'));134 t.equal(pkg.main, './lib');135 });136});137test('quux', function (t) {138 t.plan(2);139 var dir = path.join(__dirname, 'resolver/quux');140 resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) {141 if (err) t.fail(err);142 t.equal(res, path.join(dir, 'foo/index.js'));143 t.equal(pkg.main, 'quux');144 });145});146test('normalize', function (t) {147 t.plan(2);148 var dir = path.join(__dirname, 'resolver/biz/node_modules/grux');149 resolve('../grux', { basedir: dir }, function (err, res, pkg) {150 if (err) t.fail(err);151 t.equal(res, path.join(dir, 'index.js'));152 t.equal(pkg, undefined);153 });154});155test('cup', function (t) {156 t.plan(5);157 var dir = path.join(__dirname, 'resolver');158 resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) {159 if (err) t.fail(err);160 t.equal(res, path.join(dir, 'cup.coffee'));161 });162 resolve('./cup.coffee', { basedir: dir }, function (err, res) {163 if (err) t.fail(err);164 t.equal(res, path.join(dir, 'cup.coffee'));165 });166 resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) {167 t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'");168 t.equal(err.code, 'MODULE_NOT_FOUND');169 });170 // Test that filename is reported as the "from" value when passed.171 resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) {172 t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'");173 });174});175test('mug', function (t) {176 t.plan(3);177 var dir = path.join(__dirname, 'resolver');178 resolve('./mug', { basedir: dir }, function (err, res) {179 if (err) t.fail(err);180 t.equal(res, path.join(dir, 'mug.js'));181 });182 resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) {183 if (err) t.fail(err);184 t.equal(res, path.join(dir, '/mug.coffee'));185 });186 resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) {187 t.equal(res, path.join(dir, '/mug.js'));188 });189});190test('other path', function (t) {191 t.plan(6);192 var resolverDir = path.join(__dirname, 'resolver');193 var dir = path.join(resolverDir, 'bar');194 var otherDir = path.join(resolverDir, 'other_path');195 resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) {196 if (err) t.fail(err);197 t.equal(res, path.join(resolverDir, 'other_path/root.js'));198 });199 resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) {200 if (err) t.fail(err);201 t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js'));202 });203 resolve('root', { basedir: dir }, function (err, res) {204 t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'");205 t.equal(err.code, 'MODULE_NOT_FOUND');206 });207 resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) {208 t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'");209 t.equal(err.code, 'MODULE_NOT_FOUND');210 });211});212test('path iterator', function (t) {213 t.plan(2);214 var resolverDir = path.join(__dirname, 'resolver');215 var exactIterator = function (x, start, getPackageCandidates, opts) {216 return [path.join(resolverDir, x)];217 };218 resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) {219 if (err) t.fail(err);220 t.equal(res, path.join(resolverDir, 'baz/quux.js'));221 t.equal(pkg && pkg.name, 'baz');222 });223});224test('incorrect main', function (t) {225 t.plan(1);226 var resolverDir = path.join(__dirname, 'resolver');227 var dir = path.join(resolverDir, 'incorrect_main');228 resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) {229 if (err) t.fail(err);230 t.equal(res, path.join(dir, 'index.js'));231 });232});233test('without basedir', function (t) {234 t.plan(1);235 var dir = path.join(__dirname, 'resolver/without_basedir');236 var tester = require(path.join(dir, 'main.js'));237 tester(t, function (err, res, pkg) {238 if (err) {239 t.fail(err);240 } else {241 t.equal(res, path.join(dir, 'node_modules/mymodule.js'));242 }243 });244});245test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) {246 t.plan(2);247 var dir = path.join(__dirname, 'resolver');248 resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) {249 if (err) t.fail(err);250 t.equal(res, path.join(dir, 'same_names/foo.js'));251 });252 resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) {253 if (err) t.fail(err);254 t.equal(res, path.join(dir, 'same_names/foo/index.js'));255 });256});257test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) {258 t.plan(2);259 var dir = path.join(__dirname, 'resolver');260 resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) {261 if (err) t.fail(err);262 t.equal(res, path.join(dir, 'same_names/foo/index.js'));263 });264 resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) {265 if (err) t.fail(err);266 t.equal(res, path.join(dir, 'same_names/foo/index.js'));267 });268});269test('async: #121 - treating an existing file as a dir when no basedir', function (t) {270 var testFile = path.basename(__filename);271 t.test('sanity check', function (st) {272 st.plan(1);273 resolve('./' + testFile, function (err, res, pkg) {274 if (err) t.fail(err);275 st.equal(res, __filename, 'sanity check');276 });277 });278 t.test('with a fake directory', function (st) {279 st.plan(4);280 resolve('./' + testFile + '/blah', function (err, res, pkg) {281 st.ok(err, 'there is an error');282 st.notOk(res, 'no result');283 st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');284 st.equal(285 err && err.message,286 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'',287 'can not find nonexistent module'288 );289 st.end();290 });291 });292 t.end();293});294test('async dot main', function (t) {295 var start = new Date();296 t.plan(3);297 resolve('./resolver/dot_main', function (err, ret) {298 t.notOk(err);299 t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js'));300 t.ok(new Date() - start < 50, 'resolve.sync timedout');301 t.end();302 });303});304test('async dot slash main', function (t) {305 var start = new Date();306 t.plan(3);307 resolve('./resolver/dot_slash_main', function (err, ret) {308 t.notOk(err);309 t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js'));310 t.ok(new Date() - start < 50, 'resolve.sync timedout');311 t.end();312 });313});314test('not a directory', function (t) {315 t.plan(6);316 var path = './foo';317 resolve(path, { basedir: __filename }, function (err, res, pkg) {318 t.ok(err, 'a non-directory errors');319 t.equal(arguments.length, 1);320 t.equal(res, undefined);321 t.equal(pkg, undefined);322 t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\'');323 t.equal(err && err.code, 'MODULE_NOT_FOUND');324 });325});326test('non-string "main" field in package.json', function (t) {327 t.plan(5);328 var dir = path.join(__dirname, 'resolver');329 resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) {330 t.ok(err, 'errors on non-string main');331 t.equal(err.message, 'package “invalid main” `main` must be a string');332 t.equal(err.code, 'INVALID_PACKAGE_MAIN');333 t.equal(res, undefined, 'res is undefined');334 t.equal(pkg, undefined, 'pkg is undefined');335 });336});337test('non-string "main" field in package.json', function (t) {338 t.plan(5);339 var dir = path.join(__dirname, 'resolver');340 resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) {341 t.ok(err, 'errors on non-string main');342 t.equal(err.message, 'package “invalid main” `main` must be a string');343 t.equal(err.code, 'INVALID_PACKAGE_MAIN');344 t.equal(res, undefined, 'res is undefined');345 t.equal(pkg, undefined, 'pkg is undefined');346 });347});348test('browser field in package.json', function (t) {349 t.plan(3);350 var dir = path.join(__dirname, 'resolver');351 resolve(352 './browser_field',353 {354 basedir: dir,355 packageFilter: function packageFilter(pkg) {356 if (pkg.browser) {357 pkg.main = pkg.browser; // eslint-disable-line no-param-reassign358 delete pkg.browser; // eslint-disable-line no-param-reassign359 }360 return pkg;361 }362 },363 function (err, res, pkg) {364 if (err) t.fail(err);365 t.equal(res, path.join(dir, 'browser_field', 'b.js'));366 t.equal(pkg && pkg.main, 'b');367 t.equal(pkg && pkg.browser, undefined);368 }369 );...

Full Screen

Full Screen

wbuf-test.js

Source:wbuf-test.js Github

copy

Full Screen

...4 var w;5 beforeEach(function() {6 w = new WriteBuffer();7 });8 function join(arr) {9 return arr.map(function(buf) {10 return buf.toString('hex');11 }).join('');12 }13 describe('.writeUInt8', function() {14 it('should write bytes', function() {15 w.writeUInt8(1);16 w.writeUInt8(2);17 w.writeUInt8(3);18 w.writeUInt8(4);19 assert.equal(join(w.render()), '01020304');20 });21 it('should correctly handle overflow', function() {22 w.reserve(3);23 w.writeUInt8(1);24 w.writeUInt8(2);25 w.writeUInt8(3);26 w.writeUInt8(4);27 assert.equal(join(w.render()), '01020304');28 });29 });30 describe('.writeInt8', function() {31 it('should write bytes', function() {32 w.writeInt8(-1);33 w.writeInt8(2);34 assert.equal(join(w.render()), 'ff02');35 });36 });37 describe('.writeUInt16BE', function() {38 it('should write bytes', function() {39 w.writeUInt16BE(0x0102);40 w.writeUInt16BE(0x0304);41 assert.equal(join(w.render()), '01020304');42 });43 it('should correctly handle overflow', function() {44 w.reserve(2);45 w.reserve(3);46 w.writeUInt16BE(0x0102);47 w.writeUInt16BE(0x0304);48 w.writeUInt16BE(0x0506);49 assert.equal(join(w.render()), '010203040506');50 });51 });52 describe('.writeInt16BE', function() {53 it('should write bytes', function() {54 w.writeInt16BE(-0x0102);55 w.writeInt16BE(0x0304);56 assert.equal(join(w.render()), 'fefe0304');57 });58 });59 describe('.writeUInt16LE', function() {60 it('should write bytes', function() {61 w.writeUInt16LE(0x0102);62 w.writeUInt16LE(0x0304);63 assert.equal(join(w.render()), '02010403');64 });65 it('should correctly handle overflow', function() {66 w.reserve(2);67 w.reserve(3);68 w.writeUInt16LE(0x0102);69 w.writeUInt16LE(0x0304);70 w.writeUInt16LE(0x0506);71 assert.equal(join(w.render()), '020104030605');72 });73 });74 describe('.writeInt16LE', function() {75 it('should write bytes', function() {76 w.writeInt16LE(-0x0201);77 w.writeInt16LE(0x0304);78 assert.equal(join(w.render()), 'fffd0403');79 });80 });81 describe('.writeUInt24BE', function() {82 it('should write bytes', function() {83 w.writeUInt24BE(0x010203);84 w.writeUInt24BE(0x040506);85 assert.equal(join(w.render()), '010203040506');86 });87 it('should correctly set avail on boundary', function() {88 w = new WriteBuffer();89 w.reserveRate = 4;90 w.writeUInt16BE(1);91 w.writeUInt24BE(1);92 assert.equal(w.avail, 3);93 });94 });95 describe('.writeInt24BE', function() {96 it('should write bytes', function() {97 w.writeInt24BE(-0x010203);98 w.writeInt24BE(0x040506);99 assert.equal(join(w.render()), 'fefdfd040506');100 });101 });102 describe('.writeUInt24LE', function() {103 it('should write bytes', function() {104 w.writeUInt24LE(0x010203);105 w.writeUInt24LE(0x040506);106 assert.equal(join(w.render()), '030201060504');107 });108 });109 describe('.writeInt24LE', function() {110 it('should write bytes', function() {111 w.writeInt24LE(-0x010203);112 w.writeInt24LE(0x040506);113 assert.equal(join(w.render()), 'fdfdfe060504');114 });115 });116 describe('.writeUInt32BE', function() {117 it('should write bytes', function() {118 w.writeUInt32BE(0x01020304);119 w.writeUInt32BE(0x05060708);120 assert.equal(join(w.render()), '0102030405060708');121 });122 it('should write bytes on the boundary', function() {123 w.reserve(4);124 w.writeUInt8(0x00);125 w.writeUInt32BE(0x01020304);126 assert.equal(join(w.render()), '0001020304');127 });128 });129 describe('.writeInt32BE', function() {130 it('should write bytes', function() {131 w.writeInt32BE(-0x01020304);132 w.writeInt32BE(0x05060708);133 assert.equal(join(w.render()), 'fefdfcfc05060708');134 });135 });136 describe('.writeUInt32LE', function() {137 it('should write bytes', function() {138 w.writeUInt32LE(0x01020304);139 w.writeUInt32LE(0x05060708);140 assert.equal(join(w.render()), '0403020108070605');141 });142 it('should write max uint32 value', function() {143 w.writeUInt32LE(0xffffffff);144 assert.equal(join(w.render()), 'ffffffff');145 });146 });147 describe('.combWrite', function() {148 it('should write bytes', function() {149 w.writeComb(1, 'le', 0x01);150 w.writeComb(1, 'be', 0x02);151 w.writeComb(2, 'le', 0x0102);152 w.writeComb(2, 'be', 0x0304);153 w.writeComb(3, 'le', 0x010203);154 w.writeComb(3, 'be', 0x040506);155 w.writeComb(4, 'le', 0x01020304);156 w.writeComb(4, 'be', 0x05060708);157 assert.equal(join(w.render()),158 '0102020103040302010405060403020105060708');159 });160 it('should write max uint32 value', function() {161 w.writeUInt32LE(0xffffffff);162 assert.equal(join(w.render()), 'ffffffff');163 });164 });165 describe('.writeInt32LE', function() {166 it('should write bytes', function() {167 w.writeInt32LE(-0x01020304);168 w.writeInt32LE(0x05060708);169 assert.equal(join(w.render()), 'fcfcfdfe08070605');170 });171 });172 describe('.skip', function() {173 it('should skip bytes', function() {174 w.skip(4);175 w.writeUInt32BE(0xdeadbeef);176 assert(/^.{8}deadbeef$/.test(join(w.render())));177 });178 it('should skip 0 bytes', function() {179 var skip = w.skip(0);180 assert.equal(skip.size, 0);181 w.writeUInt32BE(0xdeadbeef);182 assert(/^deadbeef$/.test(join(w.render())));183 });184 it('should skip bytes on the boundary', function() {185 w.reserve(4);186 w.writeUInt8(0x01);187 var skip = w.skip(4);188 w.writeUInt32BE(0xdeadbeef);189 skip.writeUInt32BE(0xabbabaab);190 assert(/^01abbabaabdeadbeef$/.test(join(w.render())));191 });192 it('should skip bytes on the boundary in two chunks', function() {193 w.reserve(4);194 var skip1 = w.skip(2);195 var skip2 = w.skip(2);196 w.writeUInt32BE(0xdeadbeef);197 skip1.writeUInt16BE(0xabba);198 skip2.writeUInt16BE(0xbaba);199 assert(/^abbababadeadbeef$/.test(join(w.render())));200 });201 });202 describe('.slice', function() {203 it('should return empty slice', function() {204 w.writeUInt32BE(0xabbadead);205 assert.equal(join(w.slice(4, 4).render()), '');206 assert.equal(join(w.render()), 'abbadead');207 });208 it('should return full slice', function() {209 w.writeUInt32BE(0xabbadead);210 var slice = w.slice(0, 4);211 slice.writeUInt32BE(0xdeadbeef);212 assert.equal(join(slice.render()), 'deadbeef');213 assert.equal(join(w.render()), 'deadbeef');214 });215 it('should return partial slice', function() {216 w.writeUInt32BE(0xabbadead);217 var slice = w.slice(0, 3);218 slice.writeUInt24BE(0xdeadbe);219 assert.equal(join(slice.render()), 'deadbe');220 assert.equal(join(w.render()), 'deadbead');221 });222 it('should return over-the-boundary slice', function() {223 for (var i = 0; i < 16; i++) {224 w.reserve(3);225 w.writeUInt24BE(i);226 }227 assert.equal(join(w.render()),228 '000000000001000002000003000004000005000006000007' +229 '00000800000900000a00000b00000c00000d00000e00000f');230 var slice = w.slice(5, 12);231 slice.writeUInt24BE(0xaaabac);232 slice.writeUInt24BE(0xbabbbc);233 slice.writeUInt8(0xcc);234 assert.equal(join(slice.render()), 'aaabacbabbbccc');235 assert.equal(join(w.render()),236 '0000000000aaabacbabbbccc000004000005000006000007' +237 '00000800000900000a00000b00000c00000d00000e00000f');238 });239 });240 describe('.copyFrom', function() {241 it('should copy bytes', function() {242 var tmp = new Buffer(128);243 for (var i = 0; i < tmp.length; i++)244 tmp[i] = i;245 w.writeUInt32BE(0xdeadbeef);246 w.copyFrom(tmp);247 w.writeUInt32BE(0xabbadead);248 assert.equal(249 join(w.render()),250 'deadbeef000102030405060708090a0b0c0d0e0f101112131415161718191a1b' +251 '1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b' +252 '3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b' +253 '5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b' +254 '7c7d7e7fabbadead');255 });256 it('should copy bytes using offset', function() {257 var tmp = new Buffer(128);258 for (var i = 0; i < tmp.length; i++)259 tmp[i] = i;260 w.writeUInt32BE(0xdeadbeef);261 w.copyFrom(tmp, 10, 12);262 w.writeUInt32BE(0xabbadead);263 assert.equal(264 join(w.render()),265 'deadbeef0a0babbadead');266 });267 });268 describe('.write', function() {269 it('should write utf8 string', function() {270 w.writeUInt32BE(0xdeadbeef);271 w.write('ohai\u1023');272 w.writeUInt32BE(0xabbadead);273 assert.equal(274 join(w.render()),275 'deadbeef' +276 '6f6861691023' +277 'abbadead');278 });279 it('should copy bytes using offset', function() {280 var tmp = new Buffer(128);281 for (var i = 0; i < tmp.length; i++)282 tmp[i] = i;283 w.writeUInt32BE(0xdeadbeef);284 w.copyFrom(tmp, 10, 12);285 w.writeUInt32BE(0xabbadead);286 assert.equal(287 join(w.render()),288 'deadbeef0a0babbadead');289 });290 });291 describe('.skip', function() {292 it('should copy bytes', function() {293 w.reserve(5);294 var h = w.skip(4);295 w.writeUInt32BE(0xabbadead);296 h.writeUInt32BE(0xdeadbeef);297 assert.equal(298 join(w.render()),299 'deadbeefabbadead');300 });301 });302 describe('.forceReserve = true', function() {303 it('should allocate more bytes', function() {304 w.forceReserve = true;305 w.reserve(4);306 w.writeUInt32BE(0xabbadead);307 w.writeUInt32BE(0xabbadead);308 assert.equal(w.render().length, 1);309 });310 });...

Full Screen

Full Screen

resolver_sync.js

Source:resolver_sync.js Github

copy

Full Screen

1var path = require('path');2var test = require('tape');3var resolve = require('../');4test('foo', function (t) {5 var dir = path.join(__dirname, 'resolver');6 t.equal(7 resolve.sync('./foo', { basedir: dir }),8 path.join(dir, 'foo.js')9 );10 t.equal(11 resolve.sync('./foo.js', { basedir: dir }),12 path.join(dir, 'foo.js')13 );14 t.equal(15 resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }),16 path.join(dir, 'foo.js')17 );18 t.throws(function () {19 resolve.sync('foo', { basedir: dir });20 });21 // Test that filename is reported as the "from" value when passed.22 t.throws(23 function () {24 resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') });25 },26 {27 name: 'Error',28 message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'"29 }30 );31 t.end();32});33test('bar', function (t) {34 var dir = path.join(__dirname, 'resolver');35 t.equal(36 resolve.sync('foo', { basedir: path.join(dir, 'bar') }),37 path.join(dir, 'bar/node_modules/foo/index.js')38 );39 t.end();40});41test('baz', function (t) {42 var dir = path.join(__dirname, 'resolver');43 t.equal(44 resolve.sync('./baz', { basedir: dir }),45 path.join(dir, 'baz/quux.js')46 );47 t.end();48});49test('biz', function (t) {50 var dir = path.join(__dirname, 'resolver/biz/node_modules');51 t.equal(52 resolve.sync('./grux', { basedir: dir }),53 path.join(dir, 'grux/index.js')54 );55 t.equal(56 resolve.sync('tiv', { basedir: path.join(dir, 'grux') }),57 path.join(dir, 'tiv/index.js')58 );59 t.equal(60 resolve.sync('grux', { basedir: path.join(dir, 'tiv') }),61 path.join(dir, 'grux/index.js')62 );63 t.end();64});65test('normalize', function (t) {66 var dir = path.join(__dirname, 'resolver/biz/node_modules/grux');67 t.equal(68 resolve.sync('../grux', { basedir: dir }),69 path.join(dir, 'index.js')70 );71 t.end();72});73test('cup', function (t) {74 var dir = path.join(__dirname, 'resolver');75 t.equal(76 resolve.sync('./cup', {77 basedir: dir,78 extensions: ['.js', '.coffee']79 }),80 path.join(dir, 'cup.coffee')81 );82 t.equal(83 resolve.sync('./cup.coffee', { basedir: dir }),84 path.join(dir, 'cup.coffee')85 );86 t.throws(function () {87 resolve.sync('./cup', {88 basedir: dir,89 extensions: ['.js']90 });91 });92 t.end();93});94test('mug', function (t) {95 var dir = path.join(__dirname, 'resolver');96 t.equal(97 resolve.sync('./mug', { basedir: dir }),98 path.join(dir, 'mug.js')99 );100 t.equal(101 resolve.sync('./mug', {102 basedir: dir,103 extensions: ['.coffee', '.js']104 }),105 path.join(dir, 'mug.coffee')106 );107 t.equal(108 resolve.sync('./mug', {109 basedir: dir,110 extensions: ['.js', '.coffee']111 }),112 path.join(dir, 'mug.js')113 );114 t.end();115});116test('other path', function (t) {117 var resolverDir = path.join(__dirname, 'resolver');118 var dir = path.join(resolverDir, 'bar');119 var otherDir = path.join(resolverDir, 'other_path');120 t.equal(121 resolve.sync('root', {122 basedir: dir,123 paths: [otherDir]124 }),125 path.join(resolverDir, 'other_path/root.js')126 );127 t.equal(128 resolve.sync('lib/other-lib', {129 basedir: dir,130 paths: [otherDir]131 }),132 path.join(resolverDir, 'other_path/lib/other-lib.js')133 );134 t.throws(function () {135 resolve.sync('root', { basedir: dir });136 });137 t.throws(function () {138 resolve.sync('zzz', {139 basedir: dir,140 paths: [otherDir]141 });142 });143 t.end();144});145test('path iterator', function (t) {146 var resolverDir = path.join(__dirname, 'resolver');147 var exactIterator = function (x, start, getPackageCandidates, opts) {148 return [path.join(resolverDir, x)];149 };150 t.equal(151 resolve.sync('baz', { packageIterator: exactIterator }),152 path.join(resolverDir, 'baz/quux.js')153 );154 t.end();155});156test('incorrect main', function (t) {157 var resolverDir = path.join(__dirname, 'resolver');158 var dir = path.join(resolverDir, 'incorrect_main');159 t.equal(160 resolve.sync('./incorrect_main', { basedir: resolverDir }),161 path.join(dir, 'index.js')162 );163 t.end();164});165var stubStatSync = function stubStatSync(fn) {166 var fs = require('fs');167 var statSync = fs.statSync;168 try {169 fs.statSync = function () {170 throw new EvalError('Unknown Error');171 };172 return fn();173 } finally {174 fs.statSync = statSync;175 }176};177test('#79 - re-throw non ENOENT errors from stat', function (t) {178 var dir = path.join(__dirname, 'resolver');179 stubStatSync(function () {180 t.throws(function () {181 resolve.sync('foo', { basedir: dir });182 }, /Unknown Error/);183 });184 t.end();185});186test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) {187 var dir = path.join(__dirname, 'resolver');188 t.equal(189 resolve.sync('./foo', { basedir: path.join(dir, 'same_names') }),190 path.join(dir, 'same_names/foo.js')191 );192 t.equal(193 resolve.sync('./foo/', { basedir: path.join(dir, 'same_names') }),194 path.join(dir, 'same_names/foo/index.js')195 );196 t.end();197});198test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) {199 var dir = path.join(__dirname, 'resolver');200 t.equal(201 resolve.sync('./', { basedir: path.join(dir, 'same_names/foo') }),202 path.join(dir, 'same_names/foo/index.js')203 );204 t.equal(205 resolve.sync('.', { basedir: path.join(dir, 'same_names/foo') }),206 path.join(dir, 'same_names/foo/index.js')207 );208 t.end();209});210test('sync: #121 - treating an existing file as a dir when no basedir', function (t) {211 var testFile = path.basename(__filename);212 t.test('sanity check', function (st) {213 st.equal(214 resolve.sync('./' + testFile),215 __filename,216 'sanity check'217 );218 st.end();219 });220 t.test('with a fake directory', function (st) {221 function run() { return resolve.sync('./' + testFile + '/blah'); }222 st.throws(run, 'throws an error');223 try {224 run();225 } catch (e) {226 st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');227 st.equal(228 e.message,229 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'',230 'can not find nonexistent module'231 );232 }233 st.end();234 });235 t.end();236});237test('sync dot main', function (t) {238 var start = new Date();239 t.equal(resolve.sync('./resolver/dot_main'), path.join(__dirname, 'resolver/dot_main/index.js'));240 t.ok(new Date() - start < 50, 'resolve.sync timedout');241 t.end();242});243test('sync dot slash main', function (t) {244 var start = new Date();245 t.equal(resolve.sync('./resolver/dot_slash_main'), path.join(__dirname, 'resolver/dot_slash_main/index.js'));246 t.ok(new Date() - start < 50, 'resolve.sync timedout');247 t.end();248});249test('not a directory', function (t) {250 var path = './foo';251 try {252 resolve.sync(path, { basedir: __filename });253 t.fail();254 } catch (err) {255 t.ok(err, 'a non-directory errors');256 t.equal(err && err.message, 'Cannot find module \'' + path + "' from '" + __filename + "'");257 t.equal(err && err.code, 'MODULE_NOT_FOUND');258 }259 t.end();260});261test('non-string "main" field in package.json', function (t) {262 var dir = path.join(__dirname, 'resolver');263 try {264 var result = resolve.sync('./invalid_main', { basedir: dir });265 t.equal(result, undefined, 'result should not exist');266 t.fail('should not get here');267 } catch (err) {268 t.ok(err, 'errors on non-string main');269 t.equal(err.message, 'package “invalid main” `main` must be a string');270 t.equal(err.code, 'INVALID_PACKAGE_MAIN');271 }272 t.end();273});274test('non-string "main" field in package.json', function (t) {275 var dir = path.join(__dirname, 'resolver');276 try {277 var result = resolve.sync('./invalid_main', { basedir: dir });278 t.equal(result, undefined, 'result should not exist');279 t.fail('should not get here');280 } catch (err) {281 t.ok(err, 'errors on non-string main');282 t.equal(err.message, 'package “invalid main” `main` must be a string');283 t.equal(err.code, 'INVALID_PACKAGE_MAIN');284 }285 t.end();286});287test('browser field in package.json', function (t) {288 var dir = path.join(__dirname, 'resolver');289 var res = resolve.sync('./browser_field', {290 basedir: dir,291 packageFilter: function packageFilter(pkg) {292 if (pkg.browser) {293 pkg.main = pkg.browser; // eslint-disable-line no-param-reassign294 delete pkg.browser; // eslint-disable-line no-param-reassign295 }296 return pkg;297 }298 });299 t.equal(res, path.join(dir, 'browser_field', 'b.js'));300 t.end();...

Full Screen

Full Screen

build.js

Source:build.js Github

copy

Full Screen

...6const gutil = require('gulp-util');7const utils = require('./build-utils.js');8gulp.task('partials', function () {9 return gulp.src([10 path.join(conf.paths.src, '/app/**/*.html'),11 path.join(conf.paths.tmp, '/serve/app/**/*.html'),12 ])13 .pipe($.minifyHtml({14 empty: true,15 spare: true,16 quotes: true,17 }))18 .pipe($.angularTemplatecache('templateCacheHtml.js', {19 module: 'aarp-staying-sharp',20 root: 'app',21 }))22 .pipe(gulp.dest(conf.paths.tmp + '/partials/'));23});24gulp.task('partials:symlink', ['partials'], function () {25 return gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'))26 .pipe($.symlink([27 path.join(conf.paths.tmp, '/serve/templateCacheHtml.js'),28 ], { force: true }));29});30gulp.task('partials:watch', ['partials:symlink'], function () {31 gulp.watch(path.join(conf.paths.src, '/app/**/*.html'), ['partials']);32});33gulp.task('html', ['inject', 'partials'], function () {34 const htmlFilter = $.filter('*.html', { restore: true });35 const jsFilter = $.filter('**/*.js', { restore: true });36 const cssFilter = $.filter('**/*.css', { restore: true });37 const assets = $.useref.assets();38 return gulp.src(path.join(conf.paths.tmp, '/serve/*.html'))39 .pipe(assets)40 .pipe($.rev())41 .pipe(jsFilter)42 .pipe($.uglify({ preserveComments: $.uglifySaveLicense }))43 .on('error', conf.errorHandler('Uglify'))44 .pipe(jsFilter.restore)45 .pipe(cssFilter)46 .pipe($.csso())47 .pipe(cssFilter.restore)48 .pipe(assets.restore())49 .pipe($.useref())50 .pipe($.revReplace())51 .pipe(htmlFilter)52 .pipe($.minifyHtml({53 empty: true,54 spare: true,55 quotes: true,56 conditionals: true,57 }))58 .pipe(htmlFilter.restore)59 .pipe(gulp.dest(path.join(conf.paths.dist, '/')))60 .pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));61});62// Only applies for fonts from bower dependencies63// Custom fonts are handled by the "other" task64gulp.task('fonts', function () {65 return gulp.src($.mainBowerFiles())66 .pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}'))67 .pipe($.flatten())68 .pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/')));69});70gulp.task('server', function () {71 return gulp.src([72 path.join(conf.paths.src, '/server.js'),73 path.join(conf.paths.src, '/package.json')74 ])75 .pipe(gulp.dest(path.join(conf.paths.dist, '/')));76});77gulp.task('lib', function () {78 return gulp.src([79 path.join(conf.paths.src, '/lib/**/*.js')80 ]).pipe(gulp.dest(path.join(conf.paths.dist, '/lib/')));81});82gulp.task('robots', function () {83 const robotsFiles = {84 dev: 'robots.disallow.txt',85 staging: 'robots.disallow.txt',86 production: 'robots.production.txt',87 };88 const robotsForEnv = robotsFiles[utils.getEnvName()];89 return gulp.src([90 path.join(conf.paths.src, robotsForEnv)91 ])92 .pipe(rename('robots.txt'))93 .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve')))94 .pipe(gulp.dest(path.join(conf.paths.dist, '/')))95});96gulp.task('other', function () {97 return gulp.src([98 path.join(conf.paths.src, '/**/*'),99 path.join('!' + conf.paths.src, '/robots.*'),100 path.join('!' + conf.paths.src, '/**/*.{html,css,js,scss}'),101 path.join(conf.paths.src, '/**/*'),102 ])103 .pipe($.filter((file) => file.stat.isFile()))104 .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/')))105 .pipe(gulp.dest(path.join(conf.paths.dist, '/')));106});107gulp.task('elasticBeanstalkConfig', function () {108 return gulp.src([109 path.join(conf.paths.src, '/.elasticbeanstalk/**/*')110 ]).pipe(gulp.dest(path.join(conf.paths.dist, '/.elasticbeanstalk/')));111});112gulp.task('other:watch', ['other'], function () {113 gulp.watch([114 path.join(conf.paths.src, '/**/*'),115 path.join('!' + conf.paths.src, '/**/*.{html,css,js,scss}'),116 ], ['other']);117});118gulp.task('verificationFile', function () {119 const verificationFiles = {120 dev: '/client/verification-files/googlebebc04c0a7a96d72.html',121 };122 const filePath = verificationFiles[utils.getEnvName()];123 if (!filePath) { return; }124 return gulp.src(125 path.join(conf.paths.root, filePath)126 ).pipe(gulp.dest(path.join(conf.paths.dist, '/')));127});128gulp.task('clean', function (done) {129 gutil.log('deleting dist and tmp files...');130 $.del([131 path.join(conf.paths.dist, '/'),132 path.join(conf.paths.tmp, '/'),133 ], { force: true }, done);134});135gulp.task(136 'build',137 [138 'html',139 'fonts',140 'server',141 'lib',142 'redirects:import',143 'verificationFile',144 'robots',145 'other',146 'elasticBeanstalkConfig'...

Full Screen

Full Screen

constants.js

Source:constants.js Github

copy

Full Screen

1var path = require('path');2var pkg = require('../../package.json');3var pathToRoot = path.join(__dirname, '../../');4var pathToSrc = path.join(pathToRoot, 'src/');5var pathToLib = path.join(pathToRoot, 'lib/');6var pathToImageTest = path.join(pathToRoot, 'test/image');7var pathToDist = path.join(pathToRoot, 'dist/');8var pathToBuild = path.join(pathToRoot, 'build/');9var pathToTopojsonSrc = path.join(10 path.dirname(require.resolve('sane-topojson')), 'dist/'11);12var partialBundleNames = [13 'basic', 'cartesian', 'geo', 'gl3d', 'gl2d', 'mapbox'14];15var partialBundlePaths = partialBundleNames.map(function(name) {16 return {17 name: name,18 index: path.join(pathToLib, 'index-' + name + '.js'),19 dist: path.join(pathToDist, 'plotly-' + name + '.js'),20 distMin: path.join(pathToDist, 'plotly-' + name + '.min.js')21 };22});23var year = (new Date()).getFullYear();24module.exports = {25 pathToRoot: pathToRoot,26 pathToSrc: pathToSrc,27 pathToLib: pathToLib,28 pathToBuild: pathToBuild,29 pathToDist: pathToDist,30 pathToPlotlyIndex: path.join(pathToLib, 'index.js'),31 pathToPlotlyCore: path.join(pathToSrc, 'core.js'),32 pathToPlotlyBuild: path.join(pathToBuild, 'plotly.js'),33 pathToPlotlyDist: path.join(pathToDist, 'plotly.js'),34 pathToPlotlyDistMin: path.join(pathToDist, 'plotly.min.js'),35 pathToPlotlyDistWithMeta: path.join(pathToDist, 'plotly-with-meta.js'),36 partialBundleNames: partialBundleNames,37 partialBundlePaths: partialBundlePaths,38 pathToTopojsonSrc: pathToTopojsonSrc,39 pathToTopojsonDist: path.join(pathToDist, 'topojson/'),40 pathToPlotlyGeoAssetsSrc: path.join(pathToSrc, 'assets/geo_assets.js'),41 pathToPlotlyGeoAssetsDist: path.join(pathToDist, 'plotly-geo-assets.js'),42 pathToFontSVG: path.join(pathToSrc, 'fonts/ploticon/ploticon.svg'),43 pathToFontSVGBuild: path.join(pathToBuild, 'ploticon.js'),44 pathToSCSS: path.join(pathToSrc, 'css/style.scss'),45 pathToCSSBuild: path.join(pathToBuild, 'plotcss.js'),46 pathToTestDashboardBundle: path.join(pathToBuild, 'test_dashboard-bundle.js'),47 pathToImageViewerBundle: path.join(pathToBuild, 'image_viewer-bundle.js'),48 pathToTestImageMocks: path.join(pathToImageTest, 'mocks/'),49 pathToTestImageBaselines: path.join(pathToImageTest, 'baselines/'),50 pathToTestImages: path.join(pathToBuild, 'test_images/'),51 pathToTestImagesDiff: path.join(pathToBuild, 'test_images_diff/'),52 pathToTestImagesDiffList: path.join(pathToBuild, 'list_of_incorrect_images.txt'),53 pathToJasmineTests: path.join(pathToRoot, 'test/jasmine/tests'),54 pathToJasmineBundleTests: path.join(pathToRoot, 'test/jasmine/bundle_tests'),55 pathToRequireJS: path.join(pathToRoot, 'node_modules', 'requirejs', 'require.js'),56 pathToRequireJSFixture: path.join(pathToBuild, 'requirejs_fixture.js'),57 // this mapbox access token is 'public', no need to hide it58 // more info: https://www.mapbox.com/help/define-access-token/59 mapboxAccessToken: 'pk.eyJ1IjoiZXRwaW5hcmQiLCJhIjoiY2luMHIzdHE0MGFxNXVubTRxczZ2YmUxaCJ9.hwWZful0U2CQxit4ItNsiQ',60 pathToCredentials: path.join(pathToBuild, 'credentials.json'),61 pathToSetPlotConfig: path.join(pathToBuild, 'set_plot_config.js'),62 testContainerName: process.env.PLOTLYJS_TEST_CONTAINER_NAME || 'imagetest',63 testContainerPort: '9010',64 testContainerUrl: 'http://localhost:9010/',65 testContainerHome: '/var/www/streambed/image_server/plotly.js',66 uglifyOptions: {67 fromString: true,68 mangle: true,69 compress: {70 warnings: false,71 screw_ie8: true72 },73 output: {74 beautify: false,75 ascii_only: true76 }77 },78 licenseDist: [79 '/**',80 '* plotly.js v' + pkg.version,81 '* Copyright 2012-' + year + ', Plotly, Inc.',82 '* All rights reserved.',83 '* Licensed under the MIT license',84 '*/'85 ].join('\n'),86 licenseSrc: [87 '/**',88 '* Copyright 2012-' + year + ', Plotly, Inc.',89 '* All rights reserved.',90 '*',91 '* This source code is licensed under the MIT license found in the',92 '* LICENSE file in the root directory of this source tree.',93 '*/'94 ].join('\n')...

Full Screen

Full Screen

App.js

Source:App.js Github

copy

Full Screen

...6 },7 execute: function(args) {8 var path = require('path'),9 cwd = process.cwd(),10 sdkVersionFile = path.join(cwd, 'version.txt'),11 sdkVersion = new Ext.Version(require('fs').readFileSync(sdkVersionFile, 'utf8').trim()),12 appPath = path.resolve(args.path);13 this.mkdir(14 appPath,15 path.join(appPath, 'app'),16 path.join(appPath, 'app', 'model'),17 path.join(appPath, 'app', 'view'),18 path.join(appPath, 'app', 'controller'),19 path.join(appPath, 'app', 'store'),20 path.join(appPath, 'app', 'profile'),21 path.join(appPath, 'sdk'),22 path.join(appPath, 'sdk', 'src'),23 path.join(appPath, 'sdk', 'resources'),24 path.join(appPath, 'resources'),25 path.join(appPath, 'resources', 'css'),26 path.join(appPath, 'resources', 'images'),27 path.join(appPath, 'resources', 'icons'),28 path.join(appPath, 'resources', 'sass')29 );30 this.template('.senchasdk', path.join(appPath, '.senchasdk'));31 this.template('index.html', path.join(appPath, 'index.html'));32 this.template('app.js', path.join(appPath, 'app.js'));33 this.template('packager.json', path.join(appPath, 'packager.json'));34 this.template('app.json', path.join(appPath, 'app.json'), {35 name: args.name,36 sdkShortVersion: sdkVersion.getShortVersion(),37 sdkVersion: sdkVersion.toString(),38 library: args.library,39 uniqueId: this.getUniqueId()40 });41 this.template('app/view/Main.js', path.join(appPath, 'app', 'view', 'Main.js'));42 this.directory(path.join(cwd, 'src'), path.join(appPath, 'sdk', 'src'));43 this.directory(path.join(cwd, 'resources'), path.join(appPath, 'sdk', 'resources'));44 this.directory(path.join(cwd, 'command', 'src', 'module', 'generate', 'App', 'resources', 'icons'), path.join(appPath, 'resources', 'icons'));45 this.directory(path.join(cwd, 'command', 'src', 'module', 'generate', 'App', 'resources', 'loading'), path.join(appPath, 'resources', 'loading'));46 this.directory(path.join(cwd, 'command', 'src', 'module', 'generate', 'App', 'resources', 'startup'), path.join(appPath, 'resources', 'startup'));47 this.directory(path.join(cwd, 'command'), path.join(appPath, 'sdk', 'command'));48 this.file(path.join(cwd, 'microloader/development.js'), path.join(appPath, 'sdk', 'microloader/development.js'));49 this.file(path.join(cwd, 'microloader/testing.js'), path.join(appPath, 'sdk', 'microloader/testing.js'));50 this.file(path.join(cwd, 'microloader/production.js'), path.join(appPath, 'sdk', 'microloader/production.js'));51 this.file(path.join(cwd, 'version.txt'), path.join(appPath, 'sdk', 'version.txt'));52 this.file(path.join(cwd, 'sencha-touch-debug.js'), path.join(appPath, 'sdk', 'sencha-touch.js'));53 this.file(path.join(cwd, 'sencha-touch-all-debug.js'), path.join(appPath, 'sdk', 'sencha-touch-all.js'));54 this.template('resources/sass/app.scss', path.join(appPath, 'resources' , 'sass', 'app.scss'));55 this.template('resources/sass/config.rb', path.join(appPath, 'resources' , 'sass', 'config.rb'));56 this.file(path.join(cwd, 'resources/css-debug/sencha-touch.css'), path.join(appPath, 'resources', 'css', 'app.css'));57 }...

Full Screen

Full Screen

code.spec.js

Source:code.spec.js Github

copy

Full Screen

1const joinPath = require('./code');2describe('Tests', () => {3 test('the tests', () => {4 expect(joinPath('portion1', 'portion2')).toEqual('portion1/portion2');5 expect(joinPath('portion1/', 'portion2')).toEqual('portion1/portion2');6 expect(joinPath('portion1', '/portion2')).toEqual('portion1/portion2');7 expect(joinPath('portion1/', '/portion2')).toEqual('portion1/portion2');8 expect(joinPath('5wf7fny', 'stJKXlc8')).toEqual('5wf7fny/stJKXlc8');9 expect(joinPath('5wf7fny/', 'stJKXlc8')).toEqual('5wf7fny/stJKXlc8');10 expect(joinPath('5wf7fny', '/stJKXlc8')).toEqual('5wf7fny/stJKXlc8');11 expect(joinPath('5wf7fny/', '/stJKXlc8')).toEqual('5wf7fny/stJKXlc8');12 expect(joinPath('FKBZOBHo', 'GNcYGnB')).toEqual('FKBZOBHo/GNcYGnB');13 expect(joinPath('FKBZOBHo/', 'GNcYGnB')).toEqual('FKBZOBHo/GNcYGnB');14 expect(joinPath('FKBZOBHo', '/GNcYGnB')).toEqual('FKBZOBHo/GNcYGnB');15 expect(joinPath('FKBZOBHo/', '/GNcYGnB')).toEqual('FKBZOBHo/GNcYGnB');16 expect(joinPath('vL533Y3', 'uVz3nul')).toEqual('vL533Y3/uVz3nul');17 expect(joinPath('vL533Y3/', 'uVz3nul')).toEqual('vL533Y3/uVz3nul');18 expect(joinPath('vL533Y3', '/uVz3nul')).toEqual('vL533Y3/uVz3nul');19 expect(joinPath('vL533Y3/', '/uVz3nul')).toEqual('vL533Y3/uVz3nul');20 expect(joinPath('kfDOTwf', 'Xr8viY8e')).toEqual('kfDOTwf/Xr8viY8e');21 expect(joinPath('kfDOTwf/', 'Xr8viY8e')).toEqual('kfDOTwf/Xr8viY8e');22 expect(joinPath('kfDOTwf', '/Xr8viY8e')).toEqual('kfDOTwf/Xr8viY8e');23 expect(joinPath('kfDOTwf/', '/Xr8viY8e')).toEqual('kfDOTwf/Xr8viY8e');24 expect(joinPath('F4tBPmoV', 'Lv18joOw')).toEqual('F4tBPmoV/Lv18joOw');25 expect(joinPath('F4tBPmoV/', 'Lv18joOw')).toEqual('F4tBPmoV/Lv18joOw');26 expect(joinPath('F4tBPmoV', '/Lv18joOw')).toEqual('F4tBPmoV/Lv18joOw');27 expect(joinPath('F4tBPmoV/', '/Lv18joOw')).toEqual('F4tBPmoV/Lv18joOw');28 expect(joinPath('7ASOjVuT', 'wwPOgKX')).toEqual('7ASOjVuT/wwPOgKX');29 expect(joinPath('7ASOjVuT/', 'wwPOgKX')).toEqual('7ASOjVuT/wwPOgKX');30 expect(joinPath('7ASOjVuT', '/wwPOgKX')).toEqual('7ASOjVuT/wwPOgKX');31 expect(joinPath('7ASOjVuT/', '/wwPOgKX')).toEqual('7ASOjVuT/wwPOgKX');32 expect(joinPath('r1AiTrL', 'KkyjD3K')).toEqual('r1AiTrL/KkyjD3K');33 expect(joinPath('r1AiTrL/', 'KkyjD3K')).toEqual('r1AiTrL/KkyjD3K');34 expect(joinPath('r1AiTrL', '/KkyjD3K')).toEqual('r1AiTrL/KkyjD3K');35 expect(joinPath('r1AiTrL/', '/KkyjD3K')).toEqual('r1AiTrL/KkyjD3K');36 expect(joinPath('1h1gRAxu', 'apQtQYgl')).toEqual('1h1gRAxu/apQtQYgl');37 expect(joinPath('1h1gRAxu/', 'apQtQYgl')).toEqual('1h1gRAxu/apQtQYgl');38 expect(joinPath('1h1gRAxu', '/apQtQYgl')).toEqual('1h1gRAxu/apQtQYgl');39 expect(joinPath('1h1gRAxu/', '/apQtQYgl')).toEqual('1h1gRAxu/apQtQYgl');40 expect(joinPath('IYo5kuL', 'QFEM6dSv')).toEqual('IYo5kuL/QFEM6dSv');41 expect(joinPath('IYo5kuL/', 'QFEM6dSv')).toEqual('IYo5kuL/QFEM6dSv');42 expect(joinPath('IYo5kuL', '/QFEM6dSv')).toEqual('IYo5kuL/QFEM6dSv');43 expect(joinPath('IYo5kuL/', '/QFEM6dSv')).toEqual('IYo5kuL/QFEM6dSv');44 expect(joinPath('M6c7OnQI', 'nj-CEAqV')).toEqual('M6c7OnQI/nj-CEAqV');45 expect(joinPath('M6c7OnQI/', 'nj-CEAqV')).toEqual('M6c7OnQI/nj-CEAqV');46 expect(joinPath('M6c7OnQI', '/nj-CEAqV')).toEqual('M6c7OnQI/nj-CEAqV');47 expect(joinPath('M6c7OnQI/', '/nj-CEAqV')).toEqual('M6c7OnQI/nj-CEAqV');48 });...

Full Screen

Full Screen

string.test.js

Source:string.test.js Github

copy

Full Screen

2import { toHumanCase } from './string';3import { toCamelCase } from './string';4import { transformString } from './string';5test('split', () => {6 expect(split('Test String').join(' ')).toBe('test string');7 expect(split('Test String A').join(' ')).toBe('test string a');8 expect(split('Test StringA').join(' ')).toBe('test string a');9 expect(split('Test String 1').join(' ')).toBe('test string 1');10 expect(split('Test String1').join(' ')).toBe('test string 1');11 expect(split('test string').join(' ')).toBe('test string');12 expect(split('tEst string').join(' ')).toBe('t est string');13 expect(split('tEst stRing').join(' ')).toBe('t est st ring');14 expect(split('test-string').join(' ')).toBe('test string');15 expect(split('test_string').join(' ')).toBe('test string');16 expect(split('test-string-123').join(' ')).toBe('test string 123');17 expect(split('test_string_123').join(' ')).toBe('test string 123');18 expect(split('test+string+123').join(' ')).toBe('test string 123');19 expect(split('test-string123').join(' ')).toBe('test string 123');20 expect(split('test_string123').join(' ')).toBe('test string 123');21 expect(split('testString123').join(' ')).toBe('test string 123');22 expect(split('test123String').join(' ')).toBe('test 123 string');23 expect(split('Test123string').join(' ')).toBe('test 123 string');24 expect(split('test string 123').join(' ')).toBe('test string 123');25 expect(split('testAString').join(' ')).toBe('test a string');26 expect(split('ABCString').join(' ')).toBe('a b c string');27});28test('to human case', () => {29 expect(toHumanCase('testString')).toBe('Test String');30});31test('to camel case', () => {32 expect(toCamelCase('Test String')).toBe('testString');33});34test('transform string', () => {35 expect(36 transformString('translate', 100, '50%', 'rotate', 45, 'scaleX', '2.0')37 ).toBe('translate(100, 50%) rotate(45) scaleX(2.0)');...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { join } from 'stryker-parent';2import { join } from 'stryker-parent';3import { join } from 'stryker-parent';4import { join } from 'stryker-parent';5import { join } from 'stryker-parent';6import { join } from 'stryker-parent';7import { join } from 'stryker-parent';8import { join } from 'stryker-parent';9import { join } from 'stryker-parent';10import { join } from 'stryker-parent';11import { join } from 'stryker-parent';12import { join } from 'stryker-parent';13import { join } from 'stryker-parent';14import { join } from 'stryker-parent';15import { join } from 'stryker-parent';16import { join } from 'stryker-parent';17import { join } from 'stryker-parent';18import { join } from 'stryker-parent';19import { join } from 'stryker-parent';20import { join } from 'stryker-parent';

Full Screen

Using AI Code Generation

copy

Full Screen

1var parent = require('stryker-parent');2var path = require('path');3var path1 = path.join(parent, 'child1');4var path2 = path.join(parent, 'child2');5console.log(path1);6console.log(path2);

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var path = require('path');3var joinedPath = strykerParent.join('foo', 'bar');4console.log(joinedPath);5var path = require('path');6exports.join = path.join;7var path = require('path');8exports.join = path.join;9var path = require('path');10exports.join = path.join;11var path = require('path');12exports.join = path.join;13var path = require('path');14exports.join = path.join;15var path = require('path');16exports.join = path.join;17var path = require('path');18exports.join = path.join;19var path = require('path');20exports.join = path.join;21var path = require('path');22exports.join = path.join;23var path = require('path');

Full Screen

Using AI Code Generation

copy

Full Screen

1var join = require('stryker-parent').join;2var path = require('path');3var myPath = join('a', 'b');4console.log(myPath);5console.log(path.join('a', 'b'));6var join = require('stryker-parent').join;7var path = require('path');8var myPath = join('a', 'b');9console.log(myPath);10console.log(path.join('a', 'b'));11module.exports = function(config) {12 config.set({13 });14};15{16 "scripts": {17 },18 "devDependencies": {19 },20 "dependencies": {21 }22}23module.exports = {24 join: require('path').join25};26{

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerParent = require('stryker-parent');2const path = require('path');3const parentPath = strykerParent.findParentPath(process.cwd());4const joinedPath = path.join(parentPath, 'test', 'test.js');5console.log(joinedPath);6const strykerParent = require('stryker-parent');7const path = require('path');8const parentPath = strykerParent.findParentPath(process.cwd());9const joinedPath = path.join(parentPath, 'stryker.conf.js');10console.log(joinedPath);11const strykerParent = require('stryker-parent');12const path = require('path');13const parentPath = strykerParent.findParentPath(process.cwd());14const joinedPath = path.join(parentPath, 'test', 'test.js');15console.log(joinedPath);16const strykerParent = require('stryker-parent');17const path = require('path');18const parentPath = strykerParent.findParentPath(process.cwd());19const joinedPath = path.join(parentPath, 'stryker.conf.js');20console.log(joinedPath);21const strykerParent = require('stryker-parent');22const path = require('path');23const parentPath = strykerParent.findParentPath(process.cwd());24const joinedPath = path.join(parentPath, 'test', 'test.js');25console.log(joinedPath);26const strykerParent = require('stryker-parent');27const path = require('path');28const parentPath = strykerParent.findParentPath(process.cwd());29const joinedPath = path.join(parentPath, 'stryker.conf.js');30console.log(joinedPath);31const strykerParent = require('stryker-parent');32const path = require('path');

Full Screen

Using AI Code Generation

copy

Full Screen

1const stryker = require('stryker-parent');2const path = require('path');3const parentPath = stryker.join(path.join(__dirname, 'test.js'), 'stryker.conf.js');4console.log(parentPath);5const stryker = require('stryker-parent');6const path = require('path');7const parentPath = stryker.join(path.join(__dirname, 'stryker.conf.js'), 'test.js');8console.log(parentPath);9join(__dirname, 'stryker.conf.js')10join('stryker.conf.js')11join(__dirname, 'test', 'stryker.conf.js')12join('test', 'stryker.conf.js')13join(__dirname, '..', 'stryker.conf.js')14join('..', 'stryker.conf.js')15join(__dirname, '..', 'test', 'stryker.conf.js')16join('..', 'test', 'stryker.conf.js')17join(__dirname, '..', '..', 'stryker.conf.js')18join('..', '..', 'stryker.conf.js')19join(__dirname, '..', '..', 'test', 'stryker.conf.js')20join('..', '..', 'test', 'stryker.conf.js')21join(__dirname, '..', '..', '..', 'stryker.conf.js')22join('..', '..', '..', 'stryker.conf.js')23join(__dirname, '..', '..', '..', 'test', 'stryker.conf.js')24join('..', '..', '..', 'test', 'stryker.conf.js')25join(__dirname, '..', '..', '..', '..', 'stryker.conf.js')26join('..', '..', '..', '..', 'stryker.conf.js')27join(__dirname, '..', '..', '..', '..', 'test', 'stryker.conf.js')28join('

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var path = require('path');3var child = path.join(strykerParent, 'child');4console.log('child is ' + child);5var strykerParent = require('stryker-parent');6var path = require('path');7var child = path.join(strykerParent, 'child');8console.log('child is ' + child);9module.exports = function (config) {10 config.set({

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stryker-parent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful