diff --git a/src/generators/argon/sourcemap.spec.luau b/src/generators/argon/sourcemap.spec.luau index e40c622..695cf02 100644 --- a/src/generators/argon/sourcemap.spec.luau +++ b/src/generators/argon/sourcemap.spec.luau @@ -61,20 +61,20 @@ return function(test: typeof(frktest.test)) test.suite( "Generates Argon sourcemaps for test projects successfully", function() - for _, file in fs.readDir(TEST_PROJECTS_DIR) do - local testProject = `{TEST_PROJECTS_DIR}/{file}` - if not fs.isDir(testProject) or file == ".git" then + for _, entry in fs.readDir(TEST_PROJECTS_DIR) do + local path = `{TEST_PROJECTS_DIR}/{entry}` + if not fs.isDir(path) or entry == ".git" then -- Skip files that are not project directories continue end - test.case(file, function() + test.case(entry, function() -- If a file starts with `bad_` but not `bad_meta_`, we should expect a failure -- Also, sorry about this shitty regex, regex-rs does not support look-around :( local isBadMeta = regex.new( "^bad_[^m]|^bad_m[^e]|^bad_me[^t]|^bad_met[^a]" ) - local expect = if isBadMeta:isMatch(file) + local expect = if isBadMeta:isMatch(entry) then check.should_error else check.should_not_error @@ -91,7 +91,7 @@ return function(test: typeof(frktest.test)) } )() - return check.is_true(sourcemap(testProject)) + return check.is_true(sourcemap(path)) end) end) end diff --git a/src/generators/argon/sync_config.spec.luau b/src/generators/argon/sync_config.spec.luau index 5726272..9dcdad3 100644 --- a/src/generators/argon/sync_config.spec.luau +++ b/src/generators/argon/sync_config.spec.luau @@ -10,16 +10,16 @@ local TEST_PROJECTS_DIR = "./test-files/argon" return function(test: typeof(frktest.test)) test.suite("Generates valid Argon sync configs", function() - for _, dir in fs.readDir(TEST_PROJECTS_DIR) do - local fullPath = `{TEST_PROJECTS_DIR}/{dir}` - if not fs.isDir(fullPath) or dir == ".git" then + for _, entry in fs.readDir(TEST_PROJECTS_DIR) do + local path = `{TEST_PROJECTS_DIR}/{entry}` + if not fs.isDir(path) or entry == ".git" then continue end - test.case(`{dir}`, function() + test.case(`{entry}`, function() local ok, config = syncConfig( - fullPath, - fs.readDir(fullPath), + path, + fs.readDir(path), { writeToFile = false, force = true } ) check.is_true(ok) @@ -29,7 +29,7 @@ return function(test: typeof(frktest.test)) serde.decode("json", config), serde.decode( "json", - fs.readFile(`{fullPath}/default.project.json`) + fs.readFile(`{path}/default.project.json`) ) check.table.contains(realConfig, generatedConfig) diff --git a/src/generators/rojo/sourcemap.spec.luau b/src/generators/rojo/sourcemap.spec.luau index 7f7b497..4b4f363 100644 --- a/src/generators/rojo/sourcemap.spec.luau +++ b/src/generators/rojo/sourcemap.spec.luau @@ -67,20 +67,20 @@ return function(test: typeof(frktest.test)) test.suite( "Generates Rojo sourcemaps for test projects successfully", function() - for _, file in fs.readDir(TEST_PROJECTS_DIR) do - if table.find(TEST_PROJECT_EXCLUDES, file) then + for _, entry in fs.readDir(TEST_PROJECTS_DIR) do + if table.find(TEST_PROJECT_EXCLUDES, entry) then -- It does not make sense to test sourcemap generation for some of the test projects continue end - - local testProject = `{TEST_PROJECTS_DIR}/{file}` - test.case(file, function() + + local path = `{TEST_PROJECTS_DIR}/{entry}` + test.case(entry, function() -- If a file starts with `bad_` but not `bad_meta_`, we should expect a failure -- Also, sorry about this shitty regex, regex-rs does not support look-around :( local isBadMeta = regex.new( "^bad_[^m]|^bad_m[^e]|^bad_me[^t]|^bad_met[^a]" ) - local expect = if isBadMeta:isMatch(file) + local expect = if isBadMeta:isMatch(entry) then check.should_error else check.should_not_error @@ -97,7 +97,7 @@ return function(test: typeof(frktest.test)) } )() - return check.is_true(sourcemap(testProject)) + return check.is_true(sourcemap(path)) end) end) end diff --git a/src/generators/rojo/sync_config.spec.luau b/src/generators/rojo/sync_config.spec.luau index 014d247..a5bc8e4 100644 --- a/src/generators/rojo/sync_config.spec.luau +++ b/src/generators/rojo/sync_config.spec.luau @@ -13,13 +13,13 @@ local TEST_PROJECTS_DIRS = { return function(test: typeof(frktest.test)) test.suite("Generates Rojo valid sync configs", function() - for _, dir in TEST_PROJECTS_DIRS do - for _, file in fs.readDir(dir) do - local fullPath = `{dir}/{file}` - test.case(`{file}`, function() + for _, entry in TEST_PROJECTS_DIRS do + for _, subEntry in fs.readDir(entry) do + local path = `{entry}/{subEntry}` + test.case(`{subEntry}`, function() local ok, config = syncConfig( - fullPath, - fs.readDir(fullPath), + path, + fs.readDir(path), { writeToFile = false, force = true } ) check.is_true(ok) @@ -29,7 +29,7 @@ return function(test: typeof(frktest.test)) serde.decode("json", config), serde.decode( "json", - fs.readFile(`{fullPath}/default.project.json`) + fs.readFile(`{path}/default.project.json`) ) check.table.contains(realConfig, generatedConfig)