From 9a8673f950f0e45c155ece1a9c5633424246046f Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Tue, 25 Feb 2025 13:39:26 -0600 Subject: [PATCH] Update tests to use node fs (#7446) Also don't re-export fs and path through utils --- test/android-tests.ts | 4 +++- test/base-compiler-tests.ts | 7 +++++-- test/cache-tests.ts | 4 +++- test/cfg-tests.ts | 10 +++++++--- test/checks.ts | 3 +-- test/demangler-tests.ts | 11 +++++++---- test/filter-tests.ts | 3 ++- test/golang-tests.ts | 4 +++- test/java-tests.ts | 4 +++- test/lang-tests.ts | 5 +++-- test/library-tests.ts | 2 +- test/llvm-ast-parser-tests.ts | 4 ++-- test/odin-tests.ts | 4 +++- test/packager-tests.ts | 11 +++++++---- test/pascal-tests.ts | 27 ++++++++++++++------------- test/statenormalisation-tests.ts | 4 ++-- test/tool-tests.ts | 3 +-- test/unfurl-tests.ts | 6 +++--- test/utils-tests.ts | 6 +++--- test/utils.ts | 3 --- 20 files changed, 73 insertions(+), 52 deletions(-) diff --git a/test/android-tests.ts b/test/android-tests.ts index f3bf43cdd..d69526c75 100644 --- a/test/android-tests.ts +++ b/test/android-tests.ts @@ -22,6 +22,8 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; + import {beforeAll, describe, expect, it} from 'vitest'; import {CompilationEnvironment} from '../lib/compilation-env.js'; @@ -30,7 +32,7 @@ import * as utils from '../lib/utils.js'; import {ParsedAsmResultLine} from '../types/asmresult/asmresult.interfaces.js'; import {CompilerInfo} from '../types/compiler.interfaces.js'; -import {fs, makeCompilationEnvironment} from './utils.js'; +import {makeCompilationEnvironment} from './utils.js'; const languages = { androidJava: {id: 'android-java'}, diff --git a/test/base-compiler-tests.ts b/test/base-compiler-tests.ts index 893ccc7b0..af99de512 100644 --- a/test/base-compiler-tests.ts +++ b/test/base-compiler-tests.ts @@ -22,6 +22,9 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs/promises'; +import path from 'node:path'; + import {afterAll, beforeAll, describe, expect, it} from 'vitest'; import {BaseCompiler} from '../lib/base-compiler.js'; @@ -37,8 +40,6 @@ import {CompilerOverrideType, ConfiguredOverrides} from '../types/compilation/co import {CompilerInfo} from '../types/compiler.interfaces.js'; import { - fs, - path, makeCompilationEnvironment, makeFakeCompilerInfo, makeFakeParseFiltersAndOutputOptions, @@ -86,6 +87,7 @@ describe('Basic compiler invariants', () => { function testIncludeG(text: string) { expect(compiler.checkSource(text)).toBeNull(); } + testIncludeG('#include '); testIncludeG('#include // <..>'); testIncludeG('#include // for std::is_same_v<...>'); @@ -96,6 +98,7 @@ describe('Basic compiler invariants', () => { function testIncludeNotG(text: string) { expect(compiler.checkSource(text)).toEqual(':1:1: no absolute or relative includes please'); } + testIncludeNotG('#include <./.bashrc>'); testIncludeNotG('#include // <..>'); testIncludeNotG('#include <../fish.config> // for std::is_same_v<...>'); diff --git a/test/cache-tests.ts b/test/cache-tests.ts index 90b0c057f..0bd8865ff 100644 --- a/test/cache-tests.ts +++ b/test/cache-tests.ts @@ -22,6 +22,8 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; +import path from 'node:path'; import {Readable} from 'node:stream'; import {GetObjectCommand, NoSuchKey, PutObjectCommand, S3} from '@aws-sdk/client-s3'; @@ -37,7 +39,7 @@ import {NullCache} from '../lib/cache/null.js'; import {OnDiskCache} from '../lib/cache/on-disk.js'; import {S3Cache} from '../lib/cache/s3.js'; -import {fs, path, newTempDir} from './utils.js'; +import {newTempDir} from './utils.js'; function basicTests(factory: () => BaseCache) { it('should start empty', async () => { diff --git a/test/cfg-tests.ts b/test/cfg-tests.ts index 355808e19..a8500a2ca 100644 --- a/test/cfg-tests.ts +++ b/test/cfg-tests.ts @@ -22,14 +22,18 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import * as fsSync from 'node:fs'; +import fs from 'node:fs/promises'; +import path from 'node:path'; + import {describe, expect, it} from 'vitest'; import * as cfg from '../lib/cfg/cfg.js'; -import {fs, path, makeFakeCompilerInfo, resolvePathFromTestRoot} from './utils.js'; +import {makeFakeCompilerInfo, resolvePathFromTestRoot} from './utils.js'; async function DoCfgTest(cfgArg, filename, isLlvmIr = false) { - const contents = await fs.readJson(filename, 'utf8'); + const contents = JSON.parse(await fs.readFile(filename, 'utf8')); const structure = cfg.generateStructure( makeFakeCompilerInfo({ compilerType: '', @@ -47,7 +51,7 @@ describe('Cfg test cases', () => { // For backwards compatability reasons, we have a sync readdir here. For details, see // the git blame of this file. // TODO: Consider replacing with https://github.com/vitest-dev/vitest/issues/703 - const files = fs.readdirSync(testcasespath); + const files = fsSync.readdirSync(testcasespath); describe('gcc', () => { for (const filename of files.filter(x => x.includes('gcc'))) { diff --git a/test/checks.ts b/test/checks.ts index a2124dfb5..fc3f57c91 100644 --- a/test/checks.ts +++ b/test/checks.ts @@ -22,6 +22,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; import _ from 'underscore'; import {afterAll, beforeAll, describe, expect, it} from 'vitest'; @@ -29,8 +30,6 @@ import {unwrap} from '../lib/assert.js'; import {languages} from '../lib/languages.js'; import * as properties from '../lib/properties.js'; -import {fs} from './utils.js'; - describe('Live site checks', () => { let ceProps; let compilerProps; diff --git a/test/demangler-tests.ts b/test/demangler-tests.ts index e93f640e7..cd8876045 100644 --- a/test/demangler-tests.ts +++ b/test/demangler-tests.ts @@ -22,6 +22,10 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import * as fsSync from 'node:fs'; +import fs from 'node:fs/promises'; +import path from 'node:path'; + import {describe, expect, it} from 'vitest'; import {unwrap} from '../lib/assert.js'; @@ -35,7 +39,7 @@ import * as properties from '../lib/properties.js'; import {SymbolStore} from '../lib/symbol-store.js'; import * as utils from '../lib/utils.js'; -import {fs, path, makeFakeCompilerInfo, resolvePathFromTestRoot} from './utils.js'; +import {makeFakeCompilerInfo, resolvePathFromTestRoot} from './utils.js'; const cppfiltpath = 'c++filt'; @@ -305,8 +309,7 @@ describe('Basic demangling', () => { }); async function readResultFile(filename: string) { - const data = await fs.readFile(filename); - const asm = utils.splitLines(data.toString()).map(line => { + const asm = utils.splitLines(await fs.readFile(filename, 'utf-8')).map(line => { return {text: line}; }); @@ -329,7 +332,7 @@ if (process.platform === 'linux') { // For backwards compatability reasons, we have a sync readdir here. For details, see // the git blame of this file. // TODO: Consider replacing with https://github.com/vitest-dev/vitest/issues/703 - const files = fs.readdirSync(testcasespath); + const files = fsSync.readdirSync(testcasespath); for (const filename of files) { if (filename.endsWith('.asm')) { diff --git a/test/filter-tests.ts b/test/filter-tests.ts index 6447d170b..15e3f3f00 100644 --- a/test/filter-tests.ts +++ b/test/filter-tests.ts @@ -22,6 +22,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; import path from 'node:path'; import {describe, expect, it} from 'vitest'; @@ -34,7 +35,7 @@ import {AsmParser} from '../lib/parsers/asm-parser.js'; import {fakeProps} from '../lib/properties.js'; import {ParseFiltersAndOutputOptions} from '../types/features/filters.interfaces.js'; -import {fs, resolvePathFromTestRoot} from './utils.js'; +import {resolvePathFromTestRoot} from './utils.js'; function processAsm(filename: string, filters: ParseFiltersAndOutputOptions) { const file = fs.readFileSync(filename, 'utf8'); diff --git a/test/golang-tests.ts b/test/golang-tests.ts index 8ea277a49..f58ad6b63 100644 --- a/test/golang-tests.ts +++ b/test/golang-tests.ts @@ -22,13 +22,15 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; + import {beforeAll, describe, expect, it} from 'vitest'; import {GolangCompiler} from '../lib/compilers/golang.js'; import * as utils from '../lib/utils.js'; import {LanguageKey} from '../types/languages.interfaces.js'; -import {fs, makeCompilationEnvironment, makeFakeCompilerInfo} from './utils.js'; +import {makeCompilationEnvironment, makeFakeCompilerInfo} from './utils.js'; const languages = { go: {id: 'go' as LanguageKey}, diff --git a/test/java-tests.ts b/test/java-tests.ts index 51dfff5ec..40a0e247d 100644 --- a/test/java-tests.ts +++ b/test/java-tests.ts @@ -22,6 +22,8 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; + import {beforeAll, describe, expect, it} from 'vitest'; import {CompilationEnvironment} from '../lib/compilation-env.js'; @@ -30,7 +32,7 @@ import * as utils from '../lib/utils.js'; import {ParsedAsmResultLine} from '../types/asmresult/asmresult.interfaces.js'; import {CompilerInfo} from '../types/compiler.interfaces.js'; -import {fs, makeCompilationEnvironment} from './utils.js'; +import {makeCompilationEnvironment} from './utils.js'; const languages = { java: {id: 'java'}, diff --git a/test/lang-tests.ts b/test/lang-tests.ts index 5472960d1..dae741a00 100644 --- a/test/lang-tests.ts +++ b/test/lang-tests.ts @@ -22,12 +22,13 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; +import path from 'node:path'; + import {describe, expect, it} from 'vitest'; import {languages} from '../lib/languages.js'; -import {fs, path} from './utils.js'; - describe('Language definitions tests', () => { it('Has id equal to object key', () => { for (const languageKey of Object.keys(languages)) expect(languages[languageKey].id).toEqual(languageKey); diff --git a/test/library-tests.ts b/test/library-tests.ts index c1fc0c332..2e17c32ef 100644 --- a/test/library-tests.ts +++ b/test/library-tests.ts @@ -19,7 +19,7 @@ import path from 'node:path'; -import fs from 'fs-extra'; +import fs from 'node:fs/promises'; import {beforeAll, describe, expect, it} from 'vitest'; import {BaseCompiler} from '../lib/base-compiler.js'; diff --git a/test/llvm-ast-parser-tests.ts b/test/llvm-ast-parser-tests.ts index 88f116c97..14041ef05 100644 --- a/test/llvm-ast-parser-tests.ts +++ b/test/llvm-ast-parser-tests.ts @@ -22,6 +22,8 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; + import cloneDeep from 'lodash.clonedeep'; import {beforeAll, describe, expect, it} from 'vitest'; @@ -29,8 +31,6 @@ import {LlvmAstParser} from '../lib/llvm-ast.js'; import * as properties from '../lib/properties.js'; import * as utils from '../lib/utils.js'; -import {fs} from './utils.js'; - const languages = { 'c++': {id: 'c++'}, }; diff --git a/test/odin-tests.ts b/test/odin-tests.ts index 88164d1b1..2fd89ab61 100644 --- a/test/odin-tests.ts +++ b/test/odin-tests.ts @@ -22,13 +22,15 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; + import {beforeAll, describe, expect, it} from 'vitest'; import {OdinCompiler} from '../lib/compilers/odin.js'; import {CompilerOutputOptions} from '../types/features/filters.interfaces.js'; import {LanguageKey} from '../types/languages.interfaces.js'; -import {fs, makeCompilationEnvironment, makeFakeCompilerInfo} from './utils.js'; +import {makeCompilationEnvironment, makeFakeCompilerInfo} from './utils.js'; const languages = { odin: {id: 'odin' as LanguageKey}, diff --git a/test/packager-tests.ts b/test/packager-tests.ts index 538d42927..b1a5d09ff 100644 --- a/test/packager-tests.ts +++ b/test/packager-tests.ts @@ -22,13 +22,16 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs/promises'; +import path from 'node:path'; + import {describe, expect, it} from 'vitest'; import {Packager} from '../lib/packager.js'; -import {fs, path, newTempDir} from './utils.js'; +import {newTempDir} from './utils.js'; -function writeTestFile(filepath) { +async function writeTestFile(filepath) { return fs.writeFile(filepath, '#!/bin/sh\n\necho Hello, world!\n\n'); } @@ -44,7 +47,7 @@ describe('Packager', () => { const targzPath = path.join(dirPath, 'package.tgz'); await pack.package(dirPath, targzPath); - await expect(fs.exists(targzPath)).resolves.toBe(true); + await expect(fs.stat(targzPath)).resolves.toBeDefined(); }, {timeout: 5000}, ); @@ -65,7 +68,7 @@ describe('Packager', () => { await pack2.unpack(targzPath, unpackPath); const unpackedFilepath = path.join(unpackPath, 'hello.txt'); - await expect(fs.exists(unpackedFilepath)).resolves.toBe(true); + await expect(fs.stat(unpackedFilepath)).resolves.toBeDefined; }, {timeout: 5000}, ); diff --git a/test/pascal-tests.ts b/test/pascal-tests.ts index 1c414ee80..66076842f 100644 --- a/test/pascal-tests.ts +++ b/test/pascal-tests.ts @@ -22,6 +22,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs/promises'; import path from 'node:path'; import {beforeAll, describe, expect, it} from 'vitest'; @@ -32,7 +33,7 @@ import {FPCCompiler} from '../lib/compilers/pascal.js'; import {PascalDemangler} from '../lib/demangler/index.js'; import * as utils from '../lib/utils.js'; -import {fs, makeCompilationEnvironment} from './utils.js'; +import {makeCompilationEnvironment} from './utils.js'; const languages = { pascal: {id: 'pascal'}, @@ -360,7 +361,7 @@ describe('Pascal', () => { }); it('Should have line numbering', async () => { - const asmLines = utils.splitLines((await fs.readFile('test/pascal/asm-example.s')).toString()); + const asmLines = utils.splitLines(await fs.readFile('test/pascal/asm-example.s', 'utf-8')); compiler.preProcessLines(asmLines); expect(asmLines).toContain('# [output.pas]'); expect(asmLines).toContain(' .file 1 "output.pas"'); @@ -405,10 +406,10 @@ describe('Pascal', () => { }); }); - describe('Pascal filetype detection', () => { + describe('Pascal filetype detection', async () => { const pasUtils = new PascalUtils(); - const progSource = fs.readFileSync('test/pascal/prog.dpr').toString('utf8'); - const unitSource = fs.readFileSync('test/pascal/example.pas').toString('utf8'); + const progSource = await fs.readFile('test/pascal/prog.dpr', 'utf-8'); + const unitSource = await fs.readFile('test/pascal/example.pas', 'utf-8'); it('Should detect simple program', () => { expect(pasUtils.isProgram(progSource)).toEqual(true); @@ -439,7 +440,7 @@ describe('Pascal', () => { const dirPath = await compiler.newTempDir(); const filters = {}; const files = []; - const source = fs.readFileSync('examples/pascal/default.pas').toString('utf8'); + const source = await fs.readFile('examples/pascal/default.pas', 'utf-8'); const writeSummary = await compiler.writeAllFiles(dirPath, source, files, filters); @@ -452,7 +453,7 @@ describe('Pascal', () => { const dirPath = await compiler.newTempDir(); const filters = {}; const files = []; - const source = fs.readFileSync('test/pascal/example.pas').toString('utf8'); + const source = await fs.readFile('test/pascal/example.pas', 'utf-8'); const writeSummary = await compiler.writeAllFiles(dirPath, source, files, filters); @@ -465,7 +466,7 @@ describe('Pascal', () => { const dirPath = await compiler.newTempDir(); const filters = {}; const files = []; - const source = fs.readFileSync('test/pascal/prog.dpr').toString('utf8'); + const source = await fs.readFile('test/pascal/prog.dpr', 'utf-8'); const writeSummary = await compiler.writeAllFiles(dirPath, source, files, filters); @@ -483,7 +484,7 @@ describe('Pascal', () => { contents: '{ hello\n world }', }, ]; - const source = fs.readFileSync('test/pascal/prog.dpr').toString('utf8'); + const source = await fs.readFile('test/pascal/prog.dpr', 'utf-8'); const writeSummary = await compiler.writeAllFiles(dirPath, source, files, filters); @@ -511,7 +512,7 @@ describe('Pascal', () => { const dirPath = await compiler.newTempDir(); const filters = {}; const files = []; - const source = fs.readFileSync('examples/pascal/default.pas').toString('utf8'); + const source = await fs.readFile('examples/pascal/default.pas', 'utf-8'); const writeSummary = await compiler.writeAllFiles(dirPath, source, files, filters); @@ -524,7 +525,7 @@ describe('Pascal', () => { const dirPath = await compiler.newTempDir(); const filters = {}; const files = []; - const source = fs.readFileSync('test/pascal/example.pas').toString('utf8'); + const source = await fs.readFile('test/pascal/example.pas', 'utf-8'); const writeSummary = await compiler.writeAllFiles(dirPath, source, files, filters); @@ -537,7 +538,7 @@ describe('Pascal', () => { const dirPath = await compiler.newTempDir(); const filters = {}; const files = []; - const source = fs.readFileSync('test/pascal/prog.dpr').toString('utf8'); + const source = await fs.readFile('test/pascal/prog.dpr', 'utf-8'); const writeSummary = await compiler.writeAllFiles(dirPath, source, files, filters); @@ -555,7 +556,7 @@ describe('Pascal', () => { contents: '{ hello\n world }', }, ]; - const source = fs.readFileSync('test/pascal/prog.dpr').toString('utf8'); + const source = await fs.readFile('test/pascal/prog.dpr', 'utf-8'); const writeSummary = await compiler.writeAllFiles(dirPath, source, files, filters); diff --git a/test/statenormalisation-tests.ts b/test/statenormalisation-tests.ts index e9d6aa09a..31b64c995 100644 --- a/test/statenormalisation-tests.ts +++ b/test/statenormalisation-tests.ts @@ -22,13 +22,13 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs'; + import {describe, expect, it} from 'vitest'; import {ClientStateGoldenifier, ClientStateNormalizer} from '../lib/clientstate-normalizer.js'; import {ClientState} from '../lib/clientstate.js'; -import {fs} from './utils.js'; - describe('Normalizing clientstate', () => { it('Should translate 2 compilers GL layout to clientstate', () => { const normalizer = new ClientStateNormalizer(); diff --git a/test/tool-tests.ts b/test/tool-tests.ts index 16917949e..99e531818 100644 --- a/test/tool-tests.ts +++ b/test/tool-tests.ts @@ -22,6 +22,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import path from 'node:path'; import {describe, expect, it} from 'vitest'; import { @@ -35,8 +36,6 @@ import {ToolEnv} from '../lib/tooling/base-tool.interface.js'; import {CompilerDropinTool} from '../lib/tooling/compiler-dropin-tool.js'; import {ToolInfo} from '../types/tool.interfaces.js'; -import {path} from './utils.js'; - describe('CompilerDropInTool', () => { it('Should support llvm based compilers', () => { const tool = new CompilerDropinTool({} as ToolInfo, {} as ToolEnv); diff --git a/test/unfurl-tests.ts b/test/unfurl-tests.ts index eb5a74451..bfcd02d4f 100644 --- a/test/unfurl-tests.ts +++ b/test/unfurl-tests.ts @@ -22,13 +22,13 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs/promises'; + import express from 'express'; import {beforeAll, describe, expect, it} from 'vitest'; import {RouteAPI} from '../lib/handlers/route-api.js'; -import {fs} from './utils.js'; - describe('Basic unfurls', () => { const router = null as any as express.Router; let config; @@ -44,7 +44,7 @@ describe('Basic unfurls', () => { }, storageHandler: { expandId: async id => { - const json = await fs.readFile('test/state/' + id + '.json'); + const json = await fs.readFile('test/state/' + id + '.json', 'utf-8'); return { config: json, }; diff --git a/test/utils-tests.ts b/test/utils-tests.ts index 6737c335e..188469cc8 100644 --- a/test/utils-tests.ts +++ b/test/utils-tests.ts @@ -22,7 +22,9 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +import fs from 'node:fs/promises'; import path from 'node:path'; + import {fileURLToPath} from 'node:url'; import {describe, expect, it} from 'vitest'; @@ -31,8 +33,6 @@ import winston from 'winston'; import {makeLogStream} from '../lib/logger.js'; import * as utils from '../lib/utils.js'; -import {fs} from './utils.js'; - describe('Splits lines', () => { it('handles empty input', () => { expect(utils.splitLines('')).toEqual([]); @@ -550,7 +550,7 @@ describe('Hash interface', () => { describe('GoldenLayout utils', () => { it('finds every editor & compiler', async () => { - const state = await fs.readJson('test/example-states/default-state.json'); + const state = JSON.parse(await fs.readFile('test/example-states/default-state.json', 'utf-8')); const contents = utils.glGetMainContents(state.content); expect(contents).toEqual({ editors: [ diff --git a/test/utils.ts b/test/utils.ts index 24c2fd949..3f9e9e0ae 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -26,7 +26,6 @@ import os from 'node:os'; import path from 'node:path'; import {fileURLToPath} from 'node:url'; -import fs from 'fs-extra'; import temp from 'temp'; import {expect} from 'vitest'; @@ -88,5 +87,3 @@ export function newTempDir() { temp.track(true); return temp.mkdirSync({prefix: 'compiler-explorer-tests', dir: os.tmpdir()}); } - -export {path, fs};