MCPcopy Create free account
hub / github.com/angular/angular / snapshotTest

Function snapshotTest

vscode-ng-language-service/syntaxes/test/driver.ts:39–62  ·  view source on GitHub ↗
({scopeName, grammarFiles, testFile}: TestCase)

Source from the content-addressed store, hash-verified

37}
38
39async function snapshotTest({scopeName, grammarFiles, testFile}: TestCase): Promise<number> {
40 grammarFiles.push(...DUMMY_GRAMMARS);
41 const grammarOptions = grammarFiles.reduce((acc, file) => [...acc, '-g', file], [] as string[]);
42
43 const resolvedTestFile = process.env.BUILD_WORKSPACE_DIRECTORY
44 ? path.join(process.env.BUILD_WORKSPACE_DIRECTORY, 'vscode-ng-language-service', testFile)
45 : testFile;
46
47 const options = [
48 'node_modules/vscode-tmgrammar-test/dist/snapshot.js',
49 '-s',
50 scopeName,
51 ...grammarOptions,
52 resolvedTestFile,
53 ];
54
55 if (process.argv.includes('-u')) {
56 options.push('-u');
57 }
58
59 return spawn('node', options, {stdio: 'inherit' /* use parent process IO */}).catch(
60 (code) => code,
61 );
62}
63
64describe('snapshot tests', () => {
65 for (let tc of cases) {

Callers 1

driver.tsFile · 0.85

Calls 5

spawnFunction · 0.85
reduceMethod · 0.80
joinMethod · 0.65
pushMethod · 0.45
catchMethod · 0.45

Tested by

no test coverage detected