Best JavaScript code snippet using stryker-parent
glob-plugin.test.ts
Source:glob-plugin.test.ts
1import { existsSync, promises as fs } from 'fs';2import { runner, test } from './lib/runner';3import { createEntryFile, retryAssertion, wait } from './lib/util';4// SINGLE RUN5// ----------6test(7 'the plugin resolves globs provided as entrypoints',8 runner(async (t) => {9 const { build, directory } = t.context;10 const [entryFile1, entryFile2, ignoredFile] = await Promise.all([11 createEntryFile({ directory, suffix: 'entry' }),12 createEntryFile({ directory, suffix: 'entry' }),13 createEntryFile({ directory, suffix: 'ignored' }),14 ]);15 await build({16 entryPoints: ['**/*.entry.ts'],17 watchMode: false,18 });19 await retryAssertion(t, (tt) => {20 tt.true(existsSync(entryFile1.outputPath));21 tt.true(existsSync(entryFile2.outputPath));22 tt.false(existsSync(ignoredFile.outputPath));23 });24 }),25);26test(27 'the plugin handles non-glob entrypoints',28 runner(async (t) => {29 const { build, directory } = t.context;30 const [entryFile1, entryFile2, ignoredFile] = await Promise.all([31 createEntryFile({ directory, suffix: 'entry' }),32 createEntryFile({ directory, suffix: 'entry' }),33 createEntryFile({ directory, suffix: 'ignored' }),34 ]);35 await build({36 entryPoints: [entryFile1.path, entryFile2.path],37 watchMode: false,38 });39 await retryAssertion(t, (tt) => {40 tt.true(existsSync(entryFile1.outputPath));41 tt.true(existsSync(entryFile2.outputPath));42 tt.false(existsSync(ignoredFile.outputPath));43 });44 }),45);46test(47 'the plugin resolves globs provided as additionalEntrypoints',48 runner(async (t) => {49 const { build, directory } = t.context;50 const [additionalFile1, additionalFile2, ignoredFile] = await Promise.all([51 createEntryFile({ directory, suffix: 'additional' }),52 createEntryFile({ directory, suffix: 'additional' }),53 createEntryFile({ directory, suffix: 'ignored' }),54 ]);55 await build({56 entryPoints: [],57 pluginOptions: {58 additionalEntrypoints: ['**/*.additional.ts'],59 },60 watchMode: false,61 });62 await retryAssertion(t, (tt) => {63 tt.true(existsSync(additionalFile1.outputPath));64 tt.true(existsSync(additionalFile2.outputPath));65 tt.false(existsSync(ignoredFile.outputPath));66 });67 }),68);69test(70 'the plugin handles non-glob additionalEntrypoints',71 runner(async (t) => {72 const { build, directory } = t.context;73 const [additionalFile1, additionalFile2, ignoredFile] = await Promise.all([74 createEntryFile({ directory, suffix: 'additional' }),75 createEntryFile({ directory, suffix: 'additional' }),76 createEntryFile({ directory, suffix: 'ignored' }),77 ]);78 await build({79 entryPoints: [],80 pluginOptions: {81 additionalEntrypoints: [additionalFile1.path, additionalFile2.path],82 },83 watchMode: false,84 });85 await retryAssertion(t, (tt) => {86 tt.true(existsSync(additionalFile1.outputPath));87 tt.true(existsSync(additionalFile2.outputPath));88 tt.false(existsSync(ignoredFile.outputPath));89 });90 }),91);92test(93 'the plugin resolves globs provided both as entryPoints and as additionalEntrypoints',94 runner(async (t) => {95 const { build, directory } = t.context;96 const [entryFile1, entryFile2, additionalFile1, additionalFile2] = await Promise.all([97 createEntryFile({ directory, suffix: 'entry' }),98 createEntryFile({ directory, suffix: 'entry' }),99 createEntryFile({ directory, suffix: 'additional' }),100 createEntryFile({ directory, suffix: 'additional' }),101 ]);102 await build({103 entryPoints: ['**/*.entry.ts'],104 pluginOptions: {105 additionalEntrypoints: ['**/*.additional.ts'],106 },107 watchMode: false,108 });109 await retryAssertion(t, (tt) => {110 tt.true(existsSync(entryFile1.outputPath));111 tt.true(existsSync(entryFile2.outputPath));112 tt.true(existsSync(additionalFile1.outputPath));113 tt.true(existsSync(additionalFile2.outputPath));114 });115 }),116);117// WATCH MODE118// ----------119// -- ADD120test(121 'the plugin builds newly added files',122 runner(async (t) => {123 const { build, directory } = t.context;124 await build({ entryPoints: ['**/*.entry.ts'] });125 const [entryFile, ignoredFile] = await Promise.all([126 createEntryFile({ directory, suffix: 'entry' }),127 createEntryFile({ directory, suffix: 'ignored' }),128 ]);129 await retryAssertion(t, (tt) => {130 tt.true(existsSync(entryFile.path), 'the entry file was written');131 tt.true(existsSync(entryFile.outputPath), 'the output file was built');132 tt.true(existsSync(ignoredFile.path), 'the ignored file was written');133 tt.false(existsSync(ignoredFile.outputPath), 'the ignored file was not built');134 });135 }),136);137test(138 'the plugin builds newly added files provided as additionalEntrypoints',139 runner(async (t) => {140 const { build, directory } = t.context;141 await build({142 entryPoints: [],143 pluginOptions: {144 additionalEntrypoints: ['**/*.additional.ts'],145 },146 });147 const [additionalFile, ignoredFile] = await Promise.all([148 createEntryFile({ directory, suffix: 'additional' }),149 createEntryFile({ directory, suffix: 'ignored' }),150 ]);151 await retryAssertion(t, (tt) => {152 tt.true(existsSync(additionalFile.path), 'the additional file was written');153 tt.true(existsSync(additionalFile.outputPath), 'the output file was built');154 tt.true(existsSync(ignoredFile.path), 'the ignored file was written');155 tt.false(existsSync(ignoredFile.outputPath), 'the ignored file was not built');156 });157 }),158);159// -- CHANGE160test(161 'the plugin triggers a new build when the entry file changes',162 runner(async (t) => {163 const { build, directory } = t.context;164 await build();165 // Make test file and get the file stats166 const testFile = await createEntryFile({ directory });167 await retryAssertion(t, (tt) => {168 tt.true(existsSync(testFile.outputPath), 'the output file is built');169 });170 const oldStats = await fs.stat(testFile.outputPath);171 // Change the entry file172 await testFile.write();173 // Compare the old and new modified time from stats174 await retryAssertion(t, async (tt) => {175 const newStats = await fs.stat(testFile.outputPath);176 tt.true(oldStats.mtime.getTime() < newStats.mtime.getTime(), 'the output file was modified');177 });178 }),179);180test(181 'the plugin triggers a new build when a dependency of an entry file changes',182 runner(async (t) => {183 const { build, directory } = t.context;184 await build();185 // Make test file and get the file stats186 const testFile = await createEntryFile({ directory, withDependency: true });187 await retryAssertion(t, (tt) =>188 tt.true(existsSync(testFile.outputPath), 'the entry file is built'),189 );190 const oldStats = await fs.stat(testFile.outputPath);191 // Modify the dependency192 testFile.addDependency();193 await testFile.write({ dependencies: true, entry: false });194 // Compare the old and new modified time from stats195 await retryAssertion(t, async (tt) => {196 const newStats = await fs.stat(testFile.outputPath);197 tt.true(oldStats.mtime.getTime() < newStats.mtime.getTime(), 'the output file was modified');198 });199 }),200);201test(202 'the plugin should not crash when adding syntax errors to a file',203 runner(async (t) => {204 const { build, directory } = t.context;205 await build();206 // Make test file and get the file stats207 const testFile = await createEntryFile({ directory });208 await retryAssertion(t, (tt) =>209 tt.true(existsSync(testFile.outputPath), 'the entry file is built'),210 );211 const oldStats = await fs.stat(testFile.outputPath);212 // Modify the file213 testFile.addSyntaxError();214 await testFile.write();215 await wait(100);216 // Modify the file again217 testFile.removeSyntaxError();218 await testFile.write();219 // Compare the old and new modified time from stats220 await retryAssertion(t, async (tt) => {221 const newStats = await fs.stat(testFile.outputPath);222 tt.true(oldStats.mtime.getTime() < newStats.mtime.getTime(), 'the output file was modified');223 });224 }),225);226// -- UNLINK227test(228 'the plugin removes the output file when a watched entry file is removed',229 runner(async (t) => {230 const { build, directory } = t.context;231 await build();232 // Make entry file and make sure build exists233 const testFile = await createEntryFile({ directory });234 await retryAssertion(t, (tt) =>235 tt.true(existsSync(testFile.outputPath), 'the entry file is built'),236 );237 // Remove entry file and make sure build is removed238 await wait();239 await testFile.unlink();240 await retryAssertion(t, (tt) =>241 tt.false(existsSync(testFile.outputPath), 'the output file is removed'),242 );243 }),...
config.spec.js
Source:config.spec.js
...14 ignoredFiles: ['**/**/**/.DS_Store'],15 }16 describe('ignoredFile', function () {17 it('should return true if the file is ignored', function () {18 assert(utils.config.ignoredFile(conf, '/.DS_Store'))19 assert(utils.config.ignoredFile(conf, 'ds001/.DS_Store'))20 assert(utils.config.ignoredFile(conf, 'ds001/sub-01/.DS_Store'))21 })22 it('should return false if the file is not ignored', function () {23 assert(!utils.config.ignoredFile(conf, '/participants.tsv'))24 assert(!utils.config.ignoredFile(conf, 'ds001/README'))25 assert(26 !utils.config.ignoredFile(conf, 'ds001/sub-16/anat/sub-16_T1w.nii.gz'),27 )28 })29 })30 describe('interpret', function () {31 it('should return the correct severity mappings', function () {32 var severityMap = utils.config.interpret(codes, conf)33 assert.deepEqual(severityMap, {34 3: 'ignore',35 4: 'warning',36 7: 'warning',37 21: 'warning',38 33: 'error',39 34: 'error',40 })...
filesystem-ignores-files-on-changed.js
Source:filesystem-ignores-files-on-changed.js
1// Copyright 2017 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4(async function() {5 TestRunner.addResult(`Ensure that if a file that should be ignored is changed on the filesystem it does not propogate events.\n`);6 await TestRunner.loadModule('bindings_test_runner');7 TestRunner.addResult('Creating filesystem');8 var fs = new BindingsTestRunner.TestFileSystem('file:///var/www');9 await fs.reportCreatedPromise();10 Persistence.isolatedFileSystemManager.addEventListener(11 Persistence.IsolatedFileSystemManager.Events.FileSystemFilesChanged, event => {12 TestRunner.addResult('Created Files:');13 for (var createdFiles of event.data.added.valuesArray())14 TestRunner.addResult(createdFiles);15 TestRunner.addResult('');16 TestRunner.addResult('Changed Files:');17 for (var createdFiles of event.data.changed.valuesArray())18 TestRunner.addResult(createdFiles);19 TestRunner.addResult('');20 });21 TestRunner.addResult('Creating Files');22 Persistence.isolatedFileSystemManager.workspaceFolderExcludePatternSetting().set('[iI]gnored');23 TestRunner.addResult('Creating "ignoredFile"');24 var ignoredFile = fs.addFile('ignoredFile', 'content');25 TestRunner.addResult('Creating "alsoIgnoredFile"');26 var alsoIgnoredFile = fs.addFile('alsoIgnoredFile', 'content');27 TestRunner.addResult('Creating "friendlyFile"');28 var friendlyFile = fs.addFile('friendlyFile', 'content');29 TestRunner.addResult('Modifying "ignoredFile"');30 ignoredFile.setContent('content2');31 TestRunner.addResult('Modifying "alsoIgnoredFile"');32 alsoIgnoredFile.setContent('content2');33 TestRunner.addResult('Modifying "friendlyFile"');34 friendlyFile.setContent('content2');35 TestRunner.completeTest();...
Using AI Code Generation
1const ignoredFile = require('stryker-parent').ignoredFile;2module.exports = function (config) {3 config.set({4 jest: {5 config: {6 transform: {7 },8 testMatch: ['**/__tests__/**/*.js?(x)', '**/?(*.)+(spec|test).js?(x)'],9 },10 },11 });12};
Using AI Code Generation
1var ignoredFile = require('stryker-parent').ignoredFile;2var ignoredFile = require('stryker-parent').ignoredFile;3var ignoredFile = require('stryker-parent').ignoredFile;4var ignoredFile = require('stryker-parent').ignoredFile;5var ignoredFile = require('stryker-parent').ignoredFile;6var ignoredFile = require('stryker-parent').ignoredFile;7var ignoredFile = require('stryker-parent').ignoredFile;8var ignoredFile = require('stryker-parent').ignoredFile;9var ignoredFile = require('stryker-parent').ignoredFile;10var ignoredFile = require('stryker-parent').ignoredFile;11var ignoredFile = require('stryker-parent').ignoredFile;12var ignoredFile = require('stryker-parent').ignoredFile;13var ignoredFile = require('stryker-parent').ignoredFile;14var ignoredFile = require('stryker-parent').ignoredFile;15var ignoredFile = require('stryker-parent').ignoredFile;16var ignoredFile = require('stryker-parent').ignoredFile;17var ignoredFile = require('stryker-parent').ignoredFile;18var ignoredFile = require('stryker-parent
Using AI Code Generation
1const ignoredFile = require('stryker-parent').ignoredFile;2const ignoredFile = require('stryker-parent').ignoredFile;3const ignoredFile = require('stryker-parent').ignoredFile;4const ignoredFile = require('stryker-parent').ignoredFile;5const ignoredFile = require('stryker-parent').ignoredFile;6const ignoredFile = require('stryker-parent').ignoredFile;7const ignoredFile = require('stryker-parent').ignoredFile;8const ignoredFile = require('stryker-parent').ignoredFile;9const ignoredFile = require('stryker-parent').ignoredFile;10const ignoredFile = require('stryker-parent').ignoredFile;11const ignoredFile = require('stryker-parent').ignoredFile;12const ignoredFile = require('stryker-parent').ignoredFile;13const ignoredFile = require('stryker-parent').ignoredFile;14const ignoredFile = require('stryker-parent').ignoredFile;15const ignoredFile = require('stryker-parent').ignoredFile;16const ignoredFile = require('stryker-parent').ignoredFile;17const ignoredFile = require('stryker-parent').ignoredFile;18const ignoredFile = require('stryker-parent
Using AI Code Generation
1const ignoredFile = require('stryker-parent/ignoredFile');2console.log(ignoredFile('test.js'));3const ignoredFile = require('stryker/ignoredFile');4console.log(ignoredFile('test.js'));5const ignoredFile = require('stryker-parent/ignoredFile');6console.log(ignoredFile('test.js'));7const ignoredFile = require('stryker/ignoredFile');8console.log(ignoredFile('test.js'));9const ignoredFile = require('stryker-parent/ignoredFile');10console.log(ignoredFile('test.js'));11const ignoredFile = require('stryker/ignoredFile');12console.log(ignoredFile('test.js'));13const ignoredFile = require('stryker-parent/ignoredFile');14console.log(ignoredFile('test.js'));15const ignoredFile = require('stryker/ignoredFile');16console.log(ignoredFile('test.js'));17const ignoredFile = require('stryker-parent/ignoredFile');18console.log(ignoredFile('test.js'));19const ignoredFile = require('stryker/ignoredFile');20console.log(ignoredFile('test.js'));21const ignoredFile = require('stryker-parent/ignoredFile');22console.log(ignoredFile('test.js'));23const ignoredFile = require('stryker/ignoredFile');24console.log(ignoredFile('test.js'));25const ignoredFile = require('stryker-parent/ignoredFile');26console.log(ignoredFile('
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!