Skip to content

Commit

Permalink
chore: switch from del-cli back to rimraf, because del does not work …
Browse files Browse the repository at this point in the history
…on win
  • Loading branch information
webdiscus committed Dec 23, 2024
1 parent 0274117 commit eb8e78f
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
"@types/node": "^22.10.2",
"@vitest/coverage-v8": "^2.1.8",
"ansis": "file:dist",
"del-cli": "^6.0.0",
"esbuild": "^0.24.2",
"prettier": "^3.4.2",
"rimraf": "^6.0.1",
"rollup": "^4.29.1",
"rollup-plugin-copy": "^3.5.0",
"swc": "^1.0.11",
Expand Down
6 changes: 3 additions & 3 deletions test/ts/default-import-as/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"scripts": {
"build": "del dist/* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "del dist/* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "del dist/* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"build": "rimraf --glob dist/*.* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "rimraf --glob dist/*.* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "rimraf --glob dist/*.* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"view": "node ./dist/index.js"
}
}
6 changes: 3 additions & 3 deletions test/ts/default-import/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"scripts": {
"build": "del dist/* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "del dist/* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "del dist/* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"build": "rimraf --glob dist/*.* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "rimraf --glob dist/*.* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "rimraf --glob dist/*.* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"view": "node ./dist/index.js"
}
}
6 changes: 3 additions & 3 deletions test/ts/extend-colors/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"scripts": {
"build": "del dist/* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "del dist/* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "del dist/* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"build": "rimraf --glob dist/*.* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "rimraf --glob dist/*.* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "rimraf --glob dist/*.* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"view": "node ./dist/index.js"
}
}
6 changes: 3 additions & 3 deletions test/ts/mix-import/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"scripts": {
"build": "del dist/* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "del dist/* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "del dist/* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"build": "rimraf --glob dist/*.* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "rimraf --glob dist/*.* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "rimraf --glob dist/*.* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"view": "node ./dist/index.js"
}
}
6 changes: 3 additions & 3 deletions test/ts/named-import-color-func/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"scripts": {
"build": "del dist/* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "del dist/* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "del dist/* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"build": "rimraf --glob dist/*.* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "rimraf --glob dist/*.* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "rimraf --glob dist/*.* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"view": "node ./dist/index.js"
}
}
6 changes: 3 additions & 3 deletions test/ts/named-import-simple/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"scripts": {
"build": "del dist/* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "del dist/* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "del dist/* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"build": "rimraf --glob dist/*.* && tsc && node dist/index.js --color=true > dist/index.out",
"build:swc": "rimraf --glob dist/*.* && swc ./src -d dist && node dist/index.js --color=true > dist/index.out",
"build:esbuild": "rimraf --glob dist/*.* && esbuild src/index.ts --bundle --outfile=dist/index.js && node dist/index.js --color=true > dist/index.out",
"view": "node ./dist/index.js"
}
}
33 changes: 18 additions & 15 deletions test/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export const readTextFileSync = (file) => {
if (!fs.existsSync(file)) {
throw new Error(`\nERROR: the file "${file}" not found.`);
}
return fs.readFileSync(file, 'utf-8');
let content = fs.readFileSync(file, 'utf-8');

// ensue that the correct line endings are used across different operating systems
return isWin ? content.replace(/\r\n/g, '\n') : content;
};

/**
Expand Down Expand Up @@ -128,20 +131,20 @@ export const executeTSFile = (testPath, compiler = 'tsc') => {
this.result = { received, expected };

expect(received).toEqual(expected);
})
// debugging inner errors
.catch((error) => {
let message;
//console.log('>> err: ', error);
if (typeof error === 'string') {
message = '\n' + error;
} else if('stdout' in error && 'stderr' in error) {
message = error.stdout + '\n' + error.stderr;
} else {
message = '\n' + error.toString();
}

expect.fail(testPath + message);
});
// debugging inner errors
// .catch((error) => {
// let message;
// //console.log('>> err: ', error);
// if (typeof error === 'string') {
// message = '\n' + error;
// } else if('stdout' in error && 'stderr' in error) {
// message = error.stdout + '\n' + error.stderr;
// } else {
// message = '\n' + error.toString();
// }
//
// expect.fail(testPath + message);
// });

};

0 comments on commit eb8e78f

Please sign in to comment.