-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(webdriverjs): fix default commonJs export #927
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// ensure backwards compatibility of commonJs format | ||
const defaultExport = require('../dist/index.js').default; | ||
const { AxeBuilder } = require('../dist/index.js'); | ||
const assert = require('assert'); | ||
|
||
assert(typeof defaultExport === 'function', 'default export is not a function'); | ||
assert(typeof AxeBuilder === 'function', 'named export is not a function'); | ||
assert( | ||
defaultExport === AxeBuilder, | ||
'default and named export are not the same' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
// ensure compatibility of ESM format | ||
import defaultExport from '../dist/index.mjs'; | ||
import { AxeBuilder } from '../dist/index.mjs'; | ||
import assert from 'assert'; | ||
|
||
const exportIsFunction = typeof defaultExport === 'function'; | ||
assert(exportIsFunction, 'export is not a function'); | ||
assert(typeof defaultExport === 'function', 'default export is not a function'); | ||
assert(typeof AxeBuilder === 'function', 'named export is not a function') | ||
assert(defaultExport === AxeBuilder, 'default and named export are not the same'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// ensure backwards compatibility of commonJs format | ||
const defaultExport = require('../dist/index.js').default; | ||
const { AxePuppeteer } = require('../dist/index.js'); | ||
const assert = require('assert'); | ||
|
||
assert(typeof defaultExport === 'function', 'default export is not a function'); | ||
assert(typeof AxePuppeteer === 'function', 'named export is not a function'); | ||
assert( | ||
defaultExport === AxePuppeteer, | ||
'default and named export are not the same' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// ensure backwards compatibility of commonJs format | ||
global.window = {}; | ||
global.document = {}; | ||
|
||
const defaultExport = require('../dist/index.js'); | ||
const assert = require('assert'); | ||
|
||
assert(typeof defaultExport === 'function', 'export is not a function'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
global.window = {}; | ||
global.document = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// ensure backwards compatibility of commonJs format | ||
const defaultExport = require('../dist/axeReporterEarl.js').default; | ||
const assert = require('assert'); | ||
|
||
const exportIsFunction = typeof defaultExport === 'function'; | ||
assert(exportIsFunction, 'export is not a function'); |
3 changes: 2 additions & 1 deletion
3
packages/reporter-earl/esmTest.mjs → packages/reporter-earl/tests/esmTest.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// ensure backwards compatibility of commonJs format | ||
const defaultExport = require('../dist/index.js').default; | ||
const { AxeBuilder } = require('../dist/index.js'); | ||
const assert = require('assert'); | ||
|
||
assert(typeof defaultExport === 'function', 'default export is not a function'); | ||
assert(typeof AxeBuilder === 'function', 'named export is not a function'); | ||
assert( | ||
defaultExport === AxeBuilder, | ||
'default and named export are not the same' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// ensure backwards compatibility of commonJs format | ||
const implicitDefaultExport = require('../dist/index.js'); // support <4.7.3 | ||
const explicitDefaultExport = require('../dist/index.js').default; // support 4.7.3+ | ||
const { AxeBuilder } = require('../dist/index.js'); | ||
const assert = require('assert'); | ||
|
||
assert(typeof AxeBuilder === 'function', 'named export is not a function'); | ||
|
||
assert( | ||
typeof implicitDefaultExport === 'function', | ||
'implicit default export is not a function' | ||
); | ||
assert( | ||
implicitDefaultExport === AxeBuilder, | ||
'implicit default and named export are not the same' | ||
); | ||
|
||
assert( | ||
typeof explicitDefaultExport === 'function', | ||
'explicit default export is not a function' | ||
); | ||
assert( | ||
explicitDefaultExport === AxeBuilder, | ||
'explicit default and named export are not the same' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
// ensure compatibility of ESM format | ||
import defaultExport from '../dist/index.mjs'; | ||
import { AxeBuilder } from '../dist/index.mjs'; | ||
import assert from 'assert'; | ||
|
||
const exportIsFunction = typeof defaultExport === 'function'; | ||
assert(exportIsFunction, 'export is not a function'); | ||
assert(typeof defaultExport === 'function', 'default export is not a function'); | ||
assert(typeof AxeBuilder === 'function', 'named export is not a function') | ||
assert(defaultExport === AxeBuilder, 'default and named export are not the same'); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate that this causes some warning spew in the build:
warning spew
This is a reasonable warning, but one that we reasonably want to suppress here, I think. I didn't see a good way of doing that - it comes from esbuild (not eslint), which doesn't support a suppress-next-line type comment. esbuild does have a
--log-override
option to quiet it, but only for the whole build process, not for a few lines, and tsup doesn't support forwarding it anyway (they tried but encountered some issues getting it to work and abandoned it :( )I don't think it's worth more time trying to suppress the warning, just noting it here so noone repeats the same research.