Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

fix: use exports.default #234

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

fix: use exports.default #234

wants to merge 4 commits into from

Conversation

aminya
Copy link
Contributor

@aminya aminya commented Mar 24, 2021

Based on the new ES modules standard (what new Babel expects), you should not mix module.exports = with module.exports.name = as one of them overwrites the other.

Fixes the issue with the new Babel:
AtomLinter/linter-eslint#1422
image

@@ -2,5 +2,5 @@

import createRunner from "./lib/create-runner";

module.exports = createRunner();
module.exports.createRunner = createRunner;
exports.default = createRunner();
Copy link
Contributor Author

@aminya aminya Mar 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think this should not be called (?)

Suggested change
exports.default = createRunner();
exports.default = createRunner;

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

form the docs:

Your test runner module must export a single function, which Atom will call within a new window to run your package's tests.

the default export is so people can use "atomTestRunner": "atom-jasmine3-test-runner" if they want to use the default configuration.

@UziTech
Copy link
Owner

UziTech commented Mar 24, 2021

Fixes the issue with the new Babel

What new babel? is Atom updating the version of babel that it is using in newer versions?

@UziTech
Copy link
Owner

UziTech commented Mar 24, 2021

This makes the default runner fail with testRunner is not a function

@aminya
Copy link
Contributor Author

aminya commented Mar 24, 2021

I need to test this more. The only way I could export my runner was by module.exports=

@UziTech
Copy link
Owner

UziTech commented Mar 24, 2021

atom/atom#21715 was added in Atom v1.56.0-beta0 so using a .default export won't work until that is stable.

That is why I have this note in the readme for writing tests in typescript.

⚠ NOTE: If you use a custom runner that file (custom-runner.js) must be a .js file.

@aminya
Copy link
Contributor Author

aminya commented Mar 25, 2021

Ah, I thought the default export fix is already in the stable version. Isn't it?

Atom's versioning is really getting annoying

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants