Skip to content

Commit

Permalink
fix transforming error
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Jul 19, 2023
1 parent b7edf37 commit ec4ac28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
with:
name: e2e-report
path: ./e2e/test-report/
- name: Upload test coverage
- name: Upload Test Coverage
uses: actions/upload-artifact@v3
with:
name: coverage-e2e
Expand Down
19 changes: 10 additions & 9 deletions e2e/.babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const testsDir = path.resolve('./e2e/tests');
const testsBuiltDir = path.resolve('./e2e/dist');

function resolve(file) {
const found = ['', '.js', '/index.js']
const found = ['', '.ts', '/index.ts']
.map((resolution) => `${file}${resolution}`)
.find((file) => {
try {
Expand All @@ -15,9 +15,10 @@ function resolve(file) {
}
});
if (!found) {
throw new Error(`Failed to resolve ${file}`);
console.error(`Failed to resolve ${file}`);
process.exit(1);
}
return require.resolve(file);
return require.resolve(found).replace(/\.ts$/, '.js');
}

module.exports = {
Expand All @@ -29,15 +30,15 @@ module.exports = {
'\\..*': {
skipDefaultConversion: true,
transform: function (importName, matches, filename) {
const file = path.resolve(path.dirname(filename), `${matches[0]}`);
const file = resolve(
path.resolve(path.dirname(filename), `${matches[0]}`)
);
return `/${path
.relative(
process.cwd(),
resolve(
file.startsWith(testsDir)
? path.resolve(testsBuiltDir, path.relative(testsDir, file))
: file
)
file.startsWith(testsDir)
? path.resolve(testsBuiltDir, path.relative(testsDir, file))
: file
)
.replaceAll('\\', '/')}`;
},
Expand Down

0 comments on commit ec4ac28

Please sign in to comment.