@@ -27,7 +27,7 @@ import rollupPluginNodeResolve from "@rollup/plugin-node-resolve"
2727import type { LaxPartial } from "@samual/lib"
2828import { assert } from "@samual/lib/assert"
2929import { readFile , readdir as readFolder } from "fs/promises"
30- import { basename as getPathBasename , relative as getRelativePath , isAbsolute as isAbsolutePath , sep as pathSeparator , resolve as resolvePath , join as joinPath } from "path"
30+ import { basename as getPathBasename , relative as getRelativePath , isAbsolute as isAbsolutePath , sep as pathSeparator , resolve as resolvePath } from "path"
3131import prettier from "prettier"
3232import { rollup } from "rollup"
3333import { supportedExtensions as extensions } from "../constants"
@@ -418,14 +418,12 @@ export async function processScript(code: string, {
418418if ( import . meta. vitest ) {
419419 const DEBUG_LOG_PROCESSED_SCRIPTS = false
420420 const TESTS_FOLDER = `game-scripts-tests`
421- const REASSIGNMENT_TEST_FILE = `reassignment_to_const_is_invalid.ts`
422421
423422 const { test, expect } = import . meta. vitest
424423
425424 const testFiles = await Promise . all (
426425 ( await readFolder ( TESTS_FOLDER , { withFileTypes : true } ) )
427426 . filter ( dirent => dirent . isFile ( ) )
428- . filter ( dirent => dirent . name != REASSIGNMENT_TEST_FILE )
429427 . map ( async dirent => {
430428 const filePath = getRelativePath ( `.` , resolvePath ( TESTS_FOLDER , dirent . name ) )
431429 const source = await readFile ( filePath , `utf8` )
@@ -447,16 +445,8 @@ if (import.meta.vitest) {
447445 } )
448446 }
449447
450- const reassignmentTestPath = joinPath ( TESTS_FOLDER , REASSIGNMENT_TEST_FILE )
451- const reassignmentTestSource = await readFile ( reassignmentTestPath , `utf8` )
452-
453- const options : ProcessOptions = {
454- scriptName : REASSIGNMENT_TEST_FILE ,
455- filePath : reassignmentTestPath ,
456- minify : false
457- }
458-
459- expect ( async ( ) => await processScript ( reassignmentTestSource , options ) )
448+ const reassignmentTestSource = `export default () => { const i = 0; i = 1; }`
449+ expect ( async ( ) : Promise < any > => await processScript ( reassignmentTestSource , { scriptName : true , minify : false } ) )
460450 . rejects
461451 . toThrowError ( `Reassignment to const variable i is not allowed!` )
462452}
0 commit comments