Skip to content

Commit b42ed6f

Browse files
committed
fix up tests for web-test-runner
1 parent 54f7a4a commit b42ed6f

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

test/test.js

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* eslint-env mocha */
1+
import {assert} from '@open-wc/testing'
2+
import '../src/index.ts'
23

34
let count
45
const responses = {
@@ -228,23 +229,51 @@ suite('include-fragment-element', function () {
228229
)
229230
})
230231

231-
test('data is not writable', function () {
232+
test('data is not writable', async function () {
232233
const el = document.createElement('include-fragment')
233-
assert.ok(el.data !== 42)
234+
let data
235+
try {
236+
data = await el.data
237+
} catch {
238+
data = null
239+
}
240+
assert.ok(data !== 42)
234241
try {
235242
el.data = 42
243+
} catch (e) {
244+
assert.ok(e)
236245
} finally {
237-
assert.ok(el.data !== 42)
246+
let data
247+
try {
248+
data = await el.data
249+
} catch {
250+
data = null
251+
}
252+
assert.ok(data !== 42)
238253
}
239254
})
240255

241-
test('data is not configurable', function () {
256+
test('data is not configurable', async function () {
242257
const el = document.createElement('include-fragment')
243-
assert.ok(el.data !== undefined)
258+
let data
259+
try {
260+
data = await el.data
261+
} catch {
262+
data = null
263+
}
264+
assert.ok(data !== undefined)
244265
try {
245266
delete el.data
267+
} catch (e) {
268+
assert.ok(e)
246269
} finally {
247-
assert.ok(el.data !== undefined)
270+
let data
271+
try {
272+
data = await el.data
273+
} catch {
274+
data = null
275+
}
276+
assert.ok(data !== undefined)
248277
}
249278
})
250279

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"module": "es2020",
44
"target": "es2017",
55
"strict": true,
6+
"moduleResolution": "node",
67
"declaration": true,
78
"outDir": "dist",
89
"removeComments": true

0 commit comments

Comments
 (0)