@rindo/core 2.17.0 → 2.17.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/config-flags.d.ts +110 -0
- package/cli/index.cjs +612 -220
- package/cli/index.d.ts +2 -1
- package/cli/index.js +612 -220
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +391 -178
- package/compiler/rindo.min.js +2 -2
- package/dependencies.json +1 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +11 -6
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/index.js +2 -2
- package/internal/hydrate/package.json +1 -1
- package/internal/package.json +1 -1
- package/internal/rindo-private.d.ts +2 -2
- package/internal/rindo-public-compiler.d.ts +67 -48
- package/internal/testing/index.js +1 -1
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +26 -3
- package/mock-doc/index.d.ts +10 -0
- package/mock-doc/index.js +26 -3
- package/mock-doc/package.json +1 -1
- package/package.json +5 -3
- package/screenshot/package.json +1 -1
- package/sys/node/index.js +4 -4
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.d.ts +1 -1
- package/testing/index.js +49 -25
- package/testing/jest/jest-config.d.ts +1 -1
- package/testing/jest/jest-runner.d.ts +3 -2
- package/testing/jest/jest-screenshot.d.ts +1 -1
- package/testing/mocks.d.ts +27 -2
- package/testing/package.json +1 -1
- package/testing/puppeteer/puppeteer-browser.d.ts +2 -2
- package/testing/testing-utils.d.ts +74 -2
- package/testing/testing.d.ts +2 -2
package/testing/mocks.d.ts
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
|
-
import type { BuildCtx, Cache, CompilerCtx, CompilerSystem, Config, Module } from '@rindo/core/internal';
|
|
1
|
+
import type { BuildCtx, Cache, CompilerCtx, CompilerSystem, Config, LoadConfigInit, ValidatedConfig, Module, UnvalidatedConfig } from '@rindo/core/internal';
|
|
2
2
|
import { TestingSystem } from './testing-sys';
|
|
3
3
|
import { TestingLogger } from './testing-logger';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Creates a mock instance of an internal, validated Rindo configuration object
|
|
6
|
+
* @param sys an optional compiler system to associate with the config. If one is not provided, one will be created for
|
|
7
|
+
* the caller
|
|
8
|
+
* @returns the mock Rindo configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare function mockValidatedConfig(sys?: CompilerSystem): ValidatedConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a mock instance of a Rindo configuration entity. The mocked configuration has no guarantees around the
|
|
13
|
+
* types/validity of its data.
|
|
14
|
+
* @param sys an optional compiler system to associate with the config. If one is not provided, one will be created for
|
|
15
|
+
* the caller
|
|
16
|
+
* @returns the mock Rindo configuration
|
|
17
|
+
*/
|
|
18
|
+
export declare function mockConfig(sys?: CompilerSystem): UnvalidatedConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a configuration object used to bootstrap a Rindo task invocation
|
|
21
|
+
*
|
|
22
|
+
* Several fields are intentionally undefined for this entity. While it would be trivial to stub them out, this mock
|
|
23
|
+
* generation function operates under the assumption that entities like loggers and compiler system abstractions will
|
|
24
|
+
* be shared by multiple entities in a test suite, who should provide those entities to this function
|
|
25
|
+
*
|
|
26
|
+
* @param overrides the properties on the default entity to manually override
|
|
27
|
+
* @returns the default configuration initialization object, with any overrides applied
|
|
28
|
+
*/
|
|
29
|
+
export declare const mockLoadConfigInit: (overrides?: Partial<LoadConfigInit>) => LoadConfigInit;
|
|
5
30
|
export declare function mockCompilerCtx(config?: Config): CompilerCtx;
|
|
6
31
|
export declare function mockBuildCtx(config?: Config, compilerCtx?: CompilerCtx): BuildCtx;
|
|
7
32
|
export declare function mockCache(config?: Config, compilerCtx?: CompilerCtx): Cache;
|
package/testing/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ValidatedConfig } from '@rindo/core/internal';
|
|
2
2
|
import type * as puppeteer from 'puppeteer';
|
|
3
|
-
export declare function startPuppeteerBrowser(config:
|
|
3
|
+
export declare function startPuppeteerBrowser(config: ValidatedConfig): Promise<puppeteer.Browser>;
|
|
4
4
|
export declare function connectBrowser(): Promise<any>;
|
|
5
5
|
export declare function disconnectBrowser(browser: puppeteer.Browser): Promise<void>;
|
|
6
6
|
export declare function newBrowserPage(browser: puppeteer.Browser): Promise<puppeteer.Page>;
|
|
@@ -1,6 +1,78 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
1
2
|
import type * as d from '@rindo/core/internal';
|
|
2
3
|
export declare function shuffleArray(array: any[]): any[];
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Testing utility to validate the existence of some provided file paths using a specific file system
|
|
6
|
+
*
|
|
7
|
+
* @param fs the file system to use to validate the existence of some files
|
|
8
|
+
* @param filePaths the paths to validate
|
|
9
|
+
* @throws when one or more of the provided file paths cannot be found
|
|
10
|
+
*/
|
|
11
|
+
export declare function expectFilesExist(fs: d.InMemoryFileSystem, filePaths: string[]): void;
|
|
12
|
+
/**
|
|
13
|
+
* Testing utility to validate the non-existence of some provided file paths using a specific file system
|
|
14
|
+
*
|
|
15
|
+
* @param fs the file system to use to validate the non-existence of some files
|
|
16
|
+
* @param filePaths the paths to validate
|
|
17
|
+
* @throws when one or more of the provided file paths is found
|
|
18
|
+
*/
|
|
19
|
+
export declare function expectFilesDoNotExist(fs: d.InMemoryFileSystem, filePaths: string[]): void;
|
|
5
20
|
export declare function getAppScriptUrl(config: d.Config, browserUrl: string): string;
|
|
6
21
|
export declare function getAppStyleUrl(config: d.Config, browserUrl: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Utility for silencing `console` functions in tests.
|
|
24
|
+
*
|
|
25
|
+
* When this function is first called it grabs a reference to the `log`,
|
|
26
|
+
* `error`, and `warn` functions on `console` and then returns a per-test setup
|
|
27
|
+
* function which sets up a fresh set of mocks (via `jest.fn()`) and then
|
|
28
|
+
* assigns them to each of these functions. This setup function will return a
|
|
29
|
+
* reference to each of the three mock functions so tests can make assertions
|
|
30
|
+
* about their calls and so on.
|
|
31
|
+
*
|
|
32
|
+
* Because references to the original `.log`, `.error`, and `.warn` functions
|
|
33
|
+
* exist in closure within the function, it can use an `afterAll` call to clean
|
|
34
|
+
* up after itself and ensure that the original implementations are restored
|
|
35
|
+
* after the test suite finishes.
|
|
36
|
+
*
|
|
37
|
+
* An example of using this to silence log statements in a single test could look
|
|
38
|
+
* like this:
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* describe("my-test-suite", () => {
|
|
42
|
+
* const setupConsoleMocks = setupConsoleMocker()
|
|
43
|
+
*
|
|
44
|
+
* it("should log a message", () => {
|
|
45
|
+
* const { logMock } = setupConsoleMocks();
|
|
46
|
+
* myFunctionWhichLogs(foo, bar);
|
|
47
|
+
* expect(logMock).toBeCalledWith('my log message');
|
|
48
|
+
* })
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @returns a per-test mock setup function
|
|
53
|
+
*/
|
|
54
|
+
export declare function setupConsoleMocker(): ConsoleMocker;
|
|
55
|
+
interface ConsoleMocker {
|
|
56
|
+
(): {
|
|
57
|
+
logMock: jest.Mock<typeof console.log>;
|
|
58
|
+
warnMock: jest.Mock<typeof console.warn>;
|
|
59
|
+
errorMock: jest.Mock<typeof console.error>;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* the callback that `withSilentWarn` expects to receive. Basically receives a mock
|
|
64
|
+
* as its argument and returns a `Promise`, the value of which is returns by `withSilentWarn`
|
|
65
|
+
* as well.
|
|
66
|
+
*/
|
|
67
|
+
declare type SilentWarnFunc<T> = (mock: jest.Mock<typeof console.warn>) => Promise<T>;
|
|
68
|
+
/**
|
|
69
|
+
* Wrap a single callback with a silent `console.warn`. The callback passed in
|
|
70
|
+
* receives the mocking function as an argument, so you can easily make assertions
|
|
71
|
+
* that it is called if necessary.
|
|
72
|
+
*
|
|
73
|
+
* @param cb a callback which `withSilentWarn` will call after replacing `console.warn`
|
|
74
|
+
* with a mock.
|
|
75
|
+
* @returns a Promise wrapping the return value of the callback
|
|
76
|
+
*/
|
|
77
|
+
export declare function withSilentWarn<T>(cb: SilentWarnFunc<T>): Promise<T>;
|
|
78
|
+
export {};
|
package/testing/testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const createTesting: (config:
|
|
1
|
+
import type { ValidatedConfig, Testing } from '@rindo/core/internal';
|
|
2
|
+
export declare const createTesting: (config: ValidatedConfig) => Promise<Testing>;
|