Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit d8efe7a

Browse files
committed
fix: Use jsdom instead of happy-dom in test
Because some results were not properly reflected in happy-dom
1 parent 981d6a6 commit d8efe7a

File tree

5 files changed

+15
-285
lines changed

5 files changed

+15
-285
lines changed

__tests__/utils.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ describe('Utils unit', () => {
7171
);
7272
});
7373

74-
// it('setHighlightCode', async () => {
75-
// const highlightCode = ref('');
74+
it('setHighlightCode', async () => {
75+
const highlightCode = ref('');
7676

77-
// setHighlightCode({
78-
// highlightCode,
79-
// language: 'plaintext',
80-
// code: `a ${MODIFIED_START_TAG}c${MODIFIED_CLOSE_TAG} c`,
81-
// });
77+
setHighlightCode({
78+
highlightCode,
79+
language: 'plaintext',
80+
code: `a ${MODIFIED_START_TAG}c${MODIFIED_CLOSE_TAG} c`,
81+
});
8282

83-
// expect(highlightCode.value).toBe('a <span class="modified">c</span> c');
84-
// });
83+
expect(highlightCode.value).toBe('a <span class="modified">c</span> c');
84+
});
8585
});

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"eslint": "^8.14.0",
4646
"eslint-config-prettier": "^8.5.0",
4747
"eslint-plugin-vue": "^8.7.1",
48-
"happy-dom": "^2.55.0",
4948
"jsdom": "^19.0.0",
5049
"prettier": "2.6.2",
5150
"sass": "^1.50.1",

src/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ const setHighlightCode = ({
336336
.replace(new RegExp(startEntity, 'g'), '<span class="modified">')
337337
.replace(new RegExp(closeEntity, 'g'), '</span>');
338338

339+
console.log(highlightCode.value);
340+
339341
// @ts-ignore
340342
pureElement = null;
341343
};

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ export default defineConfig({
2626
},
2727
plugins: [vue(), dts()],
2828
test: {
29-
environment: 'happy-dom',
29+
environment: 'jsdom',
3030
},
3131
});

0 commit comments

Comments
 (0)