This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const idleOptions = { timeout: 500 }; | |
const request = window.requestIdleCallback || window.requestAnimationFrame; | |
const cancel = window.cancelIdleCallback || window.cancelAnimationFrame; | |
const resolveWhenIdle = { | |
request, | |
cancel, | |
promise: (num) => new Promise((resolve) => request(resolve, Object.assign({}, idleOptions, num))), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add app mount lifecycle hooks to the app instance for plugins to use when registering. | |
function addAppMountLifecycleHooks(app) { | |
const beforeHooks = []; | |
const afterHooks = []; | |
const boundMount = app.mount.bind(app); | |
app.mount = (async (rootContainer, isHydrate, isSVG) => { | |
for (const preHook of beforeHooks) await preHook(app); | |
boundMount(rootContainer, isHydrate, isSVG); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.robotstxt.org/robotstxt.html | |
User-agent: * | |
Disallow: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// setup.js - vitest | |
// This contains code that should be made available to every test and | |
// code that should be run before any mock or import in a test file. This | |
// file will execute just after the test file's environment has been loaded. | |
// if (typeof window === 'undefined') { | |
// global.window = {}; | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @vitest-environment jsdom | |
import { config, mount, shallowMount } from '@vue/test-utils'; | |
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; | |
// --------------------------------------------------------- | |
// Imports used by options API or compiled component | |
import { | |
createBlock, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; | |
// --------------------------------------------------------- | |
describe('test environment', () => { | |
it('is working as expected', () => { | |
const obj = {}; | |
expect(obj).toBeDefined(); | |
expect(true).toBeTruthy(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @vitest-environment jsdom | |
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; | |
// --------------------------------------------------------- | |
// import { itemsToMock } from '../src/testDependency.js'; | |
// --------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; | |
// --------------------------------------------------------- | |
// import { itemsToMock } from '../src/testDependency.js'; | |
// --------------------------------------------------------- | |
// vi.mock('../src/testDependency.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; | |
// --------------------------------------------------------- | |
// template unit test functions | |
// --------------------------------------------------------- | |
const isFn = (a) => typeof a === 'function'; | |
const isString = (a) => typeof a === 'string'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isFn = (a) => typeof a === 'function'; | |
const isString = (a) => typeof a === 'string'; | |
const isNumber = (a) => typeof a === 'number'; | |
const isArray = Array.isArray; | |
const isObject = (a) => a !== null && typeof a === 'object'; | |
const isActualObject = (a) => isObject(a) && !isArray(a); |