Skip to content

Commit 75bcd87

Browse files
committed
test(deps): switch form jest to vitest
1 parent c374a9a commit 75bcd87

7 files changed

+4071
-6461
lines changed

.husky/commit-msg

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
npx --no-install commitlint --edit
1+
npx --no-install commitlint --edit

__tests__/mixins.spec.scss

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// TEST //
33
// ============================================================================================= //
44

5-
@use "true" as *;
5+
@use "pkg:sass-true" as *;
66
@use "../index" as css;
77
@use "../custom-properties";
88

99
@include describe("mixins") {
1010
@include describe("declaration()") {
11-
@include it("Should return a css declaration.") {
11+
@include it("Should return a CSS declaration.") {
1212
@include assert {
1313
@include output(false) {
1414
.foo {
@@ -24,7 +24,7 @@
2424
}
2525
}
2626

27-
@include it("Should return a css declaration with custom property.") {
27+
@include it("Should return a CSS declaration with custom property.") {
2828
@include assert {
2929
@include output(false) {
3030
.test {
@@ -40,7 +40,7 @@
4040
}
4141
}
4242

43-
@include it("Should return a css declaration with `!important` option.") {
43+
@include it("Should return a CSS declaration with `!important` option.") {
4444
@include assert {
4545
@include output(false) {
4646
.foo {
@@ -74,7 +74,7 @@
7474
}
7575

7676
@include describe("declaration() with custom properties") {
77-
@include it("Should return a css declaration with custom property from `custom-properties.create()` function.") {
77+
@include it("Should return a CSS declaration with custom property from `custom-properties.create()` function.") {
7878
@include assert {
7979
@include output(false) {
8080
.test {
@@ -90,7 +90,7 @@
9090
}
9191
}
9292

93-
@include it("Should return a css declaration with custom property from `custom-properties.create()` function with missing `--`.") {
93+
@include it("Should return a CSS declaration with custom property from `custom-properties.create()` function with missing `--`.") {
9494
@include assert {
9595
@include output(false) {
9696
.test {
@@ -106,7 +106,7 @@
106106
}
107107
}
108108

109-
@include it("Should return a css declaration with `var()`.") {
109+
@include it("Should return a CSS declaration with `var()`.") {
110110
@include assert {
111111
@include output(false) {
112112
.test {
@@ -122,7 +122,7 @@
122122
}
123123
}
124124

125-
@include it("Should return a css declaration with nested `var()`.") {
125+
@include it("Should return a CSS declaration with nested `var()`.") {
126126
@include assert {
127127
@include output(false) {
128128
.test {

__tests__/scss.spec.js

+34-20
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,40 @@
22
// TESTS //
33
// ============================================================================================= //
44

5-
const path = require('path');
6-
const sassTrue = require('sass-true');
7-
const glob = require('glob');
8-
9-
const sassTestFiles = glob.sync(path.resolve(process.cwd(), './**/*.spec.scss'), {
10-
ignore: [
11-
'**/node_modules/**'
12-
]
13-
});
5+
import fs from 'fs';
6+
import path from 'path';
7+
import sassTrue from 'sass-true';
148

15-
sassTestFiles.forEach((file) => {
16-
sassTrue.runSass(
17-
{
18-
describe,
19-
it
20-
}, file,
21-
{
22-
loadPaths: [
23-
'node_modules'
24-
]
9+
function getScssTestFiles(dir) {
10+
const results = [];
11+
const entries = fs.readdirSync(dir, {
12+
withFileTypes: true
13+
});
14+
15+
entries.forEach(entry => {
16+
const fullPath = path.join(dir, entry.name);
17+
18+
if (entry.isDirectory() && entry.name !== 'node_modules') {
19+
results.push(...getScssTestFiles(fullPath));
20+
}
21+
22+
if (entry.isFile() && entry.name.endsWith('.spec.scss')) {
23+
results.push(fullPath);
2524
}
26-
);
25+
});
26+
27+
return results;
28+
}
29+
30+
const sassTestFiles = getScssTestFiles(process.cwd());
31+
32+
sassTestFiles.forEach((file) => {
33+
sassTrue.runSass({
34+
describe,
35+
it
36+
}, file, {
37+
loadPaths: [
38+
'node_modules'
39+
]
40+
});
2741
});

jest.config.js

-15
This file was deleted.

0 commit comments

Comments
 (0)