Skip to content

Commit b14926d

Browse files
committed
moved location of browser.close() in tests
1 parent bace171 commit b14926d

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

test/svelte-styles-csp/index.ts

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ describe('svelte-style-csp', async () => {
2727
);
2828
});
2929
const linkList = await linkTitles.jsonValue();
30-
30+
31+
await browser.close();
3132
for (const item of linkList) {
3233
if (item == 'svelte-stylesheet') linkTitle = item;
3334
}
34-
await browser.close();
3535
assert.equal(linkTitle, 'svelte-stylesheet');
3636
} catch (err) {
3737
throw new Error(err);
@@ -61,35 +61,6 @@ describe('svelte-style-csp', async () => {
6161
});
6262

6363
describe('test transitions without svelte-styles-csp & strict CSP', async () => {
64-
it('svelte-stylesheet not found', async () => {
65-
const absolutePath = path.join(
66-
__dirname,
67-
'svelte-test-transitions-no-styles-csp/index.html'
68-
);
69-
const browser = await puppeteer.launch({ headless: headless_browser });
70-
const page = await browser.newPage();
71-
try {
72-
await page.goto('file://' + absolutePath);
73-
let linkTitle: string;
74-
const linkTitles = await page.evaluateHandle(() => {
75-
return Array.from(document.getElementsByTagName('link')).map(
76-
(a) => a.title
77-
);
78-
});
79-
const linkList = await linkTitles.jsonValue();
80-
81-
for (const item of linkList) {
82-
if (item == 'svelte-stylesheet') linkTitle = item;
83-
}
84-
await browser.close();
85-
if (linkTitle) {
86-
console.log(linkTitle);
87-
}
88-
} catch (err) {
89-
// svelte-stylesheet is not present so throws error
90-
assert.throws(err);
91-
}
92-
});
9364
it('transitions fail with strict CSP and no style-src: unsafe-inline', async () => {
9465
const absolutePath = path.join(
9566
__dirname,
@@ -104,11 +75,11 @@ describe('svelte-style-csp', async () => {
10475
await page.waitFor(1000);
10576
}
10677
await page.click('input');
107-
await browser.close();
10878
} catch (err) {
10979
// Transitions should fail with strict CSP
11080
assert.throws(err);
11181
}
82+
await browser.close();
11283
});
11384
});
11485
});

0 commit comments

Comments
 (0)