Skip to content

Commit 836da6b

Browse files
bors[bot]bidoubiwa
andauthored
Merge #149
149: Update tests configuration r=bidoubiwa a=bidoubiwa fixes: #144 fixes: #147 Tests were failing in the background and were depending on old libraries. Co-authored-by: Charlotte Vermandel <charlottevermandel@gmail.com>
2 parents a94bde1 + 988a4a1 commit 836da6b

File tree

6 files changed

+5542
-1167
lines changed

6 files changed

+5542
-1167
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ updates:
1414
ignore:
1515
- dependency-name: "eslint*"
1616
- dependency-name: "babel-eslint"
17+
- dependency-name: "@vue/*"

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

jest.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
module.exports = {
22
rootDir: '.',
33
testMatch: ['<rootDir>/tests/**/*.js?(x)'],
4-
testEnvironment: 'jest-environment-jsdom',
5-
preset: '@vue/cli-plugin-unit-jest/presets/no-babel',
4+
preset: '@vue/cli-plugin-unit-jest',
5+
moduleNameMapper: {
6+
'docs-searchbar.js': '<rootDir>/node_modules/docs-searchbar.js/dist/cdn/docs-searchbar.js'
7+
},
68
globals: {
79
HOST_URL: 'https://e10b17e6.getmeili.com',
810
API_KEY: 'b4ff9313299e65ce4e259d3aa59730d2829c9a6805aa15b83cdbd63b20563155',

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"description": "Relevant and typo tolerant search bar for your Vuepress",
55
"author": "Clémentine Urquizar <clementine@meilisearch.com>",
66
"scripts": {
7+
"serve": "yarn --cwd ./playground install && yarn --cwd ./playground dev",
78
"lint": "eslint '{.,tests}/**/*.{vue,js}'",
89
"lint:fix": "yarn lint --fix",
9-
"serve": "yarn --cwd ./playground install && yarn --cwd ./playground dev",
10-
"test": "jest"
10+
"test": "vue-cli-service test:unit"
1111
},
1212
"main": "index.js",
1313
"dependencies": {
@@ -18,16 +18,17 @@
1818
},
1919
"devDependencies": {
2020
"@vue/cli-plugin-unit-jest": "^4.5.13",
21-
"@vue/test-utils": "1.2.0",
21+
"@vue/cli-plugin-babel": "^4.5.13",
22+
"@vue/cli-service": "^4.5.13",
23+
"@vue/test-utils": "^1.2.0",
2224
"babel-eslint": "^10.1.0",
2325
"eslint": "^7.25.0",
24-
"eslint-config-standard": "^16.0.2",
26+
"eslint-config-standard": "^16.0.3",
2527
"eslint-plugin-import": "^2.20.2",
2628
"eslint-plugin-node": "^11.1.0",
2729
"eslint-plugin-promise": "^4.3.1",
2830
"eslint-plugin-standard": "^5.0.0",
2931
"eslint-plugin-vue": "^7.9.0",
30-
"jest": "^26.0.1",
3132
"vue": "^2.6.11",
3233
"vue-template-compiler": "^2.6.11"
3334
},

tests/MeiliSearchBoxTest.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ import { shallowMount } from '@vue/test-utils'
22
import MeiliSearchBox from '../MeiliSearchBox.vue'
33

44
describe('MeiliSearchBox', () => {
5-
const wrapper = shallowMount(
6-
MeiliSearchBox,
7-
{
8-
mocks: {
9-
$site: { themeConfig: {} }
5+
let wrapper = null
6+
7+
beforeEach(() => {
8+
wrapper = shallowMount(
9+
MeiliSearchBox,
10+
{
11+
mocks: {
12+
$site: { themeConfig: {} }
13+
}
1014
}
11-
}
12-
)
15+
)
16+
})
1317

1418
it('renders default form and input', () => {
1519
expect(wrapper.html()).toContain('<form id="search-form" role="search" class="meilisearch-search-wrapper search-box">')

0 commit comments

Comments
 (0)