diff --git a/test/.eslintrc.json b/test/.eslintrc.json index d5ba8f9d9c..fc493fa889 100644 --- a/test/.eslintrc.json +++ b/test/.eslintrc.json @@ -1,5 +1,6 @@ { "rules": { - "no-console": "off" + "no-console": "off", + "@typescript-eslint/no-var-requires": "off" } } diff --git a/test/js/update.ts b/test/js/update.ts index 03cb252921..d89226b8b2 100644 --- a/test/js/update.ts +++ b/test/js/update.ts @@ -1,14 +1,16 @@ import { readFileSync, writeFileSync } from 'fs'; -import { resolve } from 'path'; +import { glob } from '../tiny-glob'; // this file will replace all the expected.js files with their _actual // equivalents. Only use it when you're sure that you haven't // broken anything! + const svelte = (function loadSvelte(test) { process.env.TEST = test ? 'true' : ''; const resolved = require.resolve('../../compiler.js'); delete require.cache[resolved]; return require(resolved); })(false); + function loadConfig(file) { try { const resolved = require.resolve(file); @@ -24,8 +26,8 @@ function loadConfig(file) { throw err; } } -require(resolve(__dirname, '../tiny-glob.ts')) - .glob('samples/*/input.svelte', { cwd: __dirname }) + +glob('samples/*/input.svelte', { cwd: __dirname }) .forEach((file) => { writeFileSync( `${__dirname}/${file.replace('input.svelte', 'expected.js')}`, diff --git a/test/parser/update.ts b/test/parser/update.ts index c08e244f0c..5cc729725d 100644 --- a/test/parser/update.ts +++ b/test/parser/update.ts @@ -1,5 +1,6 @@ import { readFileSync, writeFileSync } from 'fs'; -import { resolve } from 'path'; +import { glob } from '../tiny-glob'; + // this file will replace all the expected.js files with their _actual // equivalents. Only use it when you're sure that you haven't // broken anything! @@ -9,8 +10,8 @@ const svelte = (function loadSvelte(test) { delete require.cache[resolved]; return require(resolved); })(false); -require(resolve(__dirname, '../tiny-glob.ts')) - .glob('samples/*/input.svelte', { cwd: __dirname }) + +glob('samples/*/input.svelte', { cwd: __dirname }) .forEach((file) => { try { writeFileSync(