Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from jest to vitest (wip) #92

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
48acce5
chore(deps): install vitest
ayushmanchhabra Jun 22, 2024
b18f5b6
chore(ci): upgrade github actions
ayushmanchhabra Jun 22, 2024
1b69e1e
chore(ci): use Node v18.7.0
ayushmanchhabra Jun 22, 2024
123c37f
fix(ci): resolve syntax error
ayushmanchhabra Jun 22, 2024
237f8b8
chore: use Node v18.20.3
ayushmanchhabra Jun 22, 2024
3682301
chore(test): migrate tests from jest to vitest
ayushmanchhabra Jun 22, 2024
7fcf412
chore(ci): use volta action to get old node versions
ayushmanchhabra Jun 22, 2024
ce4703e
chore(test): port jest mocks to vitest
ayushmanchhabra Jun 22, 2024
d650af5
chore(ci): pin node versions using volta
ayushmanchhabra Jun 22, 2024
80ddf84
fix(ci): resolve syntax error
ayushmanchhabra Jun 22, 2024
63d96cf
chore(ci): cancel in progress jobs
ayushmanchhabra Jun 22, 2024
ba038db
fix(ci): resolve syntax error
ayushmanchhabra Jun 22, 2024
374456d
chore(ci): add back some deleted config
ayushmanchhabra Jun 22, 2024
fe9c552
chore(ci): node 18.20.3 -> 18.x
ayushmanchhabra Jun 22, 2024
ff48fdd
fix(ci): npm -v on Node 18 only
ayushmanchhabra Jun 22, 2024
4e83e86
chore(ci): node 8 -> 8.3.0
ayushmanchhabra Jun 22, 2024
8186509
chore(eslint): add back tjw-jest
ayushmanchhabra Jun 23, 2024
4df6457
chore(vite): remove timeout config
ayushmanchhabra Jun 23, 2024
294439d
chore(vitest): enable global apis
ayushmanchhabra Jun 23, 2024
f10dcd8
chore(jest): remove jest workaround comment
ayushmanchhabra Jun 23, 2024
62957ef
chore: revert to original module import style
ayushmanchhabra Jun 23, 2024
91c9bbd
Merge branch 'dev-82' of github.com:nwutils/create-desktop-shortcuts …
ayushmanchhabra Jun 23, 2024
2f480e5
chore(ci): volta pin npm version for Node 8
ayushmanchhabra Jun 23, 2024
95b962a
chore(vitest): mock some node modules
ayushmanchhabra Jun 23, 2024
2fc245f
chore(vitest): misc changes
ayushmanchhabra Jun 23, 2024
6f7300c
chore(deps): update lock file
ayushmanchhabra Jun 23, 2024
b17cf2e
chore(vitest): mock node:os
ayushmanchhabra Jun 25, 2024
ddda8da
chore(test): helper test suite passes
ayushmanchhabra Jun 25, 2024
8e05557
chore(test): jest -> vi
ayushmanchhabra Jun 25, 2024
68f490d
Merge branch 'dev-82' of github.com:nwutils/create-desktop-shortcuts …
ayushmanchhabra Jun 25, 2024
969fdf9
Merge branch 'main' into dev-82
ayushmanchhabra Jun 25, 2024
8d9e777
chore: revert some things
ayushmanchhabra Aug 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(jest): remove jest workaround comment
Co-authored-by: The Jared Wilcurt <TheJaredWilcurt@users.noreply.github.com>
ayushmanchhabra and TheJaredWilcurt authored Jun 23, 2024
commit f10dcd8db71358ef4e0a822cd46685926c160776
2 changes: 0 additions & 2 deletions tests/setup.js
Original file line number Diff line number Diff line change
@@ -23,5 +23,3 @@ afterEach(() => {
vi.clearAllMocks();
});

// Jest's setTimeout defaults to 5 seconds.
// Bump the timeout to 60 seconds.

Unchanged files with check annotations Beta

.toEqual(false);
expect(customLogger)
.toHaveBeenLastCalledWith(

Check failure on line 18 in tests/index.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/index.test.js > createDesktopShortcut > Empty options

AssertionError: expected last "spy" call to have been called with [ …(2) ] - Expected + Received Array [ "No shortcuts were created due to lack of accurate details passed in to options object", Object { "customLogger": [Function spy], + "onlyCurrentOS": true, + "verbose": true, }, ] ❯ tests/index.test.js:18:8

Check failure on line 18 in tests/index.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/index.test.js > createDesktopShortcut > Empty options

AssertionError: expected last "spy" call to have been called with [ …(2) ] - Expected + Received Array [ "No shortcuts were created due to lack of accurate details passed in to options object", Object { "customLogger": [Function spy], + "onlyCurrentOS": true, + "verbose": true, }, ] ❯ tests/index.test.js:18:8
'No shortcuts were created due to lack of accurate details passed in to options object',
{
...defaults,
test('~', () => {
expect(resolveTilde('~'))
.toEqual('/home/DUMMY');

Check failure on line 81 in tests/src/helpers.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/src/helpers.test.js > helpers > resolveTilde > ~

AssertionError: expected '/Users/runner' to deeply equal '/home/DUMMY' - Expected + Received - /home/DUMMY + /Users/runner ❯ tests/src/helpers.test.js:81:10

Check failure on line 81 in tests/src/helpers.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/src/helpers.test.js > helpers > resolveTilde > ~

AssertionError: expected '/home/runner' to deeply equal '/home/DUMMY' - Expected + Received - /home/DUMMY + /home/runner ❯ tests/src/helpers.test.js:81:10
});
test('~/', () => {
expect(resolveTilde('~/'))
.toEqual('/home/DUMMY/');

Check failure on line 86 in tests/src/helpers.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/src/helpers.test.js > helpers > resolveTilde > ~/

AssertionError: expected '/Users/runner/' to deeply equal '/home/DUMMY/' - Expected + Received - /home/DUMMY/ + /Users/runner/ ❯ tests/src/helpers.test.js:86:10

Check failure on line 86 in tests/src/helpers.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/src/helpers.test.js > helpers > resolveTilde > ~/

AssertionError: expected '/home/runner/' to deeply equal '/home/DUMMY/' - Expected + Received - /home/DUMMY/ + /home/runner/ ❯ tests/src/helpers.test.js:86:10
});
test('~/folder', () => {
expect(resolveTilde('~/folder'))
.toEqual('/home/DUMMY/folder');

Check failure on line 91 in tests/src/helpers.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/src/helpers.test.js > helpers > resolveTilde > ~/folder

AssertionError: expected '/Users/runner/folder' to deeply equal '/home/DUMMY/folder' - Expected + Received - /home/DUMMY/folder + /Users/runner/folder ❯ tests/src/helpers.test.js:91:10

Check failure on line 91 in tests/src/helpers.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/src/helpers.test.js > helpers > resolveTilde > ~/folder

AssertionError: expected '/home/runner/folder' to deeply equal '/home/DUMMY/folder' - Expected + Received - /home/DUMMY/folder + /home/runner/folder ❯ tests/src/helpers.test.js:91:10
});
test('~alias/folder', () => {
test('Basic instructions', () => {
expect(library.makeLinuxShortcut(options))
.toEqual(true);

Check failure on line 197 in tests/src/library.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/src/library.test.js > library > makeLinuxShortcut > Basic instructions

AssertionError: expected false to deeply equal true - Expected + Received - true + false ❯ tests/src/library.test.js:197:10

Check failure on line 197 in tests/src/library.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/src/library.test.js > library > makeLinuxShortcut > Basic instructions

AssertionError: expected false to deeply equal true - Expected + Received - true + false ❯ tests/src/library.test.js:197:10
expect(customLogger)
.not.toHaveBeenCalled();
options.linux.outputPath = 'Throw Error';
expect(library.makeLinuxShortcut(options))
.toEqual(false);

Check failure on line 230 in tests/src/library.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/src/library.test.js > library > makeLinuxShortcut > Error writing file

AssertionError: expected true to deeply equal false - Expected + Received - false + true ❯ tests/src/library.test.js:230:10

Check failure on line 230 in tests/src/library.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/src/library.test.js > library > makeLinuxShortcut > Error writing file

AssertionError: expected true to deeply equal false - Expected + Received - false + true ❯ tests/src/library.test.js:230:10
expect(customLogger)
.toHaveBeenLastCalledWith(
options.linux.outputPath = 'Throw chmod';
expect(library.makeLinuxShortcut(options))
.toEqual(false);

Check failure on line 277 in tests/src/library.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/src/library.test.js > library > makeLinuxShortcut > Error setting permissions

AssertionError: expected true to deeply equal false - Expected + Received - false + true ❯ tests/src/library.test.js:277:10

Check failure on line 277 in tests/src/library.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/src/library.test.js > library > makeLinuxShortcut > Error setting permissions

AssertionError: expected true to deeply equal false - Expected + Received - false + true ❯ tests/src/library.test.js:277:10
expect(customLogger)
.toHaveBeenLastCalledWith('ERROR attempting to change permisions of Throw chmod', 'Successfully errored');
.not.toHaveBeenCalled();
expect(childProcess.spawnSync)
.toHaveBeenLastCalledWith(

Check failure on line 328 in tests/src/library.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/src/library.test.js > library > makeWindowsShortcut > Basic instructions

AssertionError: expected last "spawnSync" call to have been called with [ 'wscript', [ …(9) ] ] - Expected: Array [ "wscript", Array [ "/Users/runner/work/create-desktop-shortcuts/create-desktop-shortcuts/src/windows.vbs", "C:/Users/DUMMY/Desktop/file.lnk", "C:/file.ext", "", "", "", "C:/file.ext", 1, "", ], ] + Received: undefined ❯ tests/src/library.test.js:328:10

Check failure on line 328 in tests/src/library.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/src/library.test.js > library > makeWindowsShortcut > Basic instructions

AssertionError: expected last "spawnSync" call to have been called with [ 'wscript', [ …(9) ] ] - Expected: Array [ "wscript", Array [ "/home/runner/work/create-desktop-shortcuts/create-desktop-shortcuts/src/windows.vbs", "C:/Users/DUMMY/Desktop/file.lnk", "C:/file.ext", "", "", "", "C:/file.ext", 1, "", ], ] + Received: undefined ❯ tests/src/library.test.js:328:10
'wscript',
[
library.produceWindowsVBSPath(),
.not.toHaveBeenCalled();
expect(childProcess.spawnSync)
.toHaveBeenLastCalledWith(

Check failure on line 357 in tests/src/library.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/src/library.test.js > library > makeWindowsShortcut > Use window mode default

AssertionError: expected last "spawnSync" call to have been called with [ 'wscript', [ …(9) ] ] - Expected: Array [ "wscript", Array [ "/Users/runner/work/create-desktop-shortcuts/create-desktop-shortcuts/src/windows.vbs", "C:/Users/DUMMY/Desktop/file.lnk", "C:/file.ext", "", "", "", "C:/file.ext", 1, "", ], ] + Received: undefined ❯ tests/src/library.test.js:357:10

Check failure on line 357 in tests/src/library.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/src/library.test.js > library > makeWindowsShortcut > Use window mode default

AssertionError: expected last "spawnSync" call to have been called with [ 'wscript', [ …(9) ] ] - Expected: Array [ "wscript", Array [ "/home/runner/work/create-desktop-shortcuts/create-desktop-shortcuts/src/windows.vbs", "C:/Users/DUMMY/Desktop/file.lnk", "C:/file.ext", "", "", "", "C:/file.ext", 1, "", ], ] + Received: undefined ❯ tests/src/library.test.js:357:10
'wscript',
[
library.produceWindowsVBSPath(),
.not.toHaveBeenCalled();
expect(childProcess.spawnSync)
.toHaveBeenLastCalledWith(

Check failure on line 386 in tests/src/library.test.js

GitHub Actions / build (macos-latest, 18.x)

tests/src/library.test.js > library > makeWindowsShortcut > Icon

AssertionError: expected last "spawnSync" call to have been called with [ 'wscript', [ …(9) ] ] - Expected: Array [ "wscript", Array [ "/Users/runner/work/create-desktop-shortcuts/create-desktop-shortcuts/src/windows.vbs", "C:/Users/DUMMY/Desktop/file.lnk", "C:/file.ext", "", "", "", "C:/Users/DUMMY/icon.ico", 1, "", ], ] + Received: undefined ❯ tests/src/library.test.js:386:10

Check failure on line 386 in tests/src/library.test.js

GitHub Actions / build (ubuntu-latest, 18.x)

tests/src/library.test.js > library > makeWindowsShortcut > Icon

AssertionError: expected last "spawnSync" call to have been called with [ 'wscript', [ …(9) ] ] - Expected: Array [ "wscript", Array [ "/home/runner/work/create-desktop-shortcuts/create-desktop-shortcuts/src/windows.vbs", "C:/Users/DUMMY/Desktop/file.lnk", "C:/file.ext", "", "", "", "C:/Users/DUMMY/icon.ico", 1, "", ], ] + Received: undefined ❯ tests/src/library.test.js:386:10
'wscript',
[
library.produceWindowsVBSPath(),