Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
coverage/
dist/
extend.js
extend.d.ts
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { overrides, ...config } = require('@hover/javascript/eslint')
const {overrides, ...config} = require('@hover/javascript/eslint')

module.exports = {
...config,
ignorePatterns: ['dom-testing-library.js', 'rollup.input.js'],
parserOptions: {
project: ['tsconfig.json', 'tsconfig.eslint.json'],
project: ['tsconfig.eslint.json'],
},
}
6 changes: 2 additions & 4 deletions lib/__tests__/extend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ describe('lib/extend.ts', () => {
let page: playwright.Page
let document: playwright.ElementHandle

it('should require without error', async () => {
beforeAll(async () => {
await import('../extend')
})

it('should launch playwright', async () => {
browser = await playwright.chromium.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']})
page = await browser.newPage()
await page.goto(`file://${path.join(__dirname, 'fixtures/page.html')}`)
Expand Down Expand Up @@ -57,6 +54,7 @@ describe('lib/extend.ts', () => {
fail() // eslint-disable-line jest/no-jasmine-globals
} catch (err) {
err.message = err.message.replace(/(\s*at .*(\n|$))+/gm, '\n <stack>:X:X')
// eslint-disable-next-line jest/no-try-expect
expect(err.message).toMatchSnapshot()
}
})
Expand Down
20 changes: 10 additions & 10 deletions lib/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('lib/index.ts', () => {
let browser: playwright.Browser
let page: playwright.Page

it('should launch playwright', async () => {
beforeAll(async () => {
browser = await playwright.chromium.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']})
page = await browser.newPage()
await page.goto(`file://${path.join(__dirname, 'fixtures/page.html')}`)
Expand All @@ -31,16 +31,16 @@ describe('lib/index.ts', () => {
expect(await queries.getNodeText(element)).toEqual('Hello h1')
})

it('should load the defered page', async () => {
await page.goto(`file://${path.join(__dirname, 'fixtures/late-page.html')}`)
})
describe('loading the deferred page', () => {
beforeEach(async () => page.goto(`file://${path.join(__dirname, 'fixtures/late-page.html')}`))

it('should use `wait` properly', async () => {
const {getByText} = getQueriesForElement(await getDocument(page))
// eslint-disable-next-line @typescript-eslint/no-misused-promises
await wait(() => getByText('Loaded!'), {timeout: 7000})
expect(await getByText('Loaded!')).toBeTruthy()
}, 9000)
it('should use `wait` properly', async () => {
const {getByText} = getQueriesForElement(await getDocument(page))
// eslint-disable-next-line @typescript-eslint/no-misused-promises
await wait(() => getByText('Loaded!'), {timeout: 7000})
expect(await getByText('Loaded!')).toBeTruthy()
}, 9000)
})

afterAll(async () => {
await browser.close()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"wait-for-expect": "^3.0.2"
},
"devDependencies": {
"@hover/javascript": "^4.4.0",
"@hover/javascript": "^4.17.0",
"@rollup/plugin-commonjs": "^14.0.0",
"@rollup/plugin-node-resolve": "^8.0.0",
"@rollup/plugin-replace": "^2.3.1",
Expand Down
Loading