Skip to content

Instantly share code, notes, and snippets.

Avatar
🌶️

Andrei Picus NiGhTTraX

🌶️
View GitHub Profile
View nest-cli.json
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"entryFile": "examples/nestjs/src/main"
}
View next.config.js
module.exports = {
experimental: {
externalDir: true,
},
};
View nest-cli.json
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"webpack": true
}
}
View next.config.js
module.exports = {
webpack: (config) => {
// Let Babel compile outside of src/.
const tsRule = config.module.rules.find(
(rule) => rule.test && rule.test.toString().includes("tsx|ts")
);
tsRule.include = undefined;
tsRule.exclude = /node_modules/;
return config;
View mugshot-vit.ts
export function vit(
name: string,
definition: () => Promise<any>,
selector:string = '#root > *'
) {
it(name, async () => {
await definition();
const result = await mugshot.check(name, selector);
expect(result.matches).to.be.true;
@NiGhTTraX
NiGhTTraX / test-output.md
Last active Jun 19, 2019
Mugshot failing result
View test-output.md
Expected Actual Diff
expected actual diff
@NiGhTTraX
NiGhTTraX / mugshot.spec.ts
Last active Jun 19, 2019
Visual test with Mugshot
View mugshot.spec.ts
import Mugshot from 'mugshot';
import WebdriverIOAdapter from '@mugshot/webdriverio';
describe('Mugshot README', () => {
/* BROWSER SETUP */
/* Identical setup from previous example omitted.
/* ENDBROWSER SETUP */
it('should have a logo', async () => {
await browser.url('https://github.com/NiGhTTraX/mugshot/blob/master/README.md');
@NiGhTTraX
NiGhTTraX / test.spec.ts
Last active Jun 19, 2019
Simple example of a browser test using Mocha, Chai and WebdriverIO
View test.spec.ts
import { remote } from 'webdriverio';
import { expect } from 'chai';
import { describe, it, before, after } from 'mocha';
describe('Mugshot README', () => {
/* BROWSER SETUP */
let browser!: ReturnType<typeof remote>;
before(async () => {
const options = {
View medium-button-with-confirm.jsx
class ButtonWithConfirm extends Component {
constructor(props) {
super(props);
this.state = { confirming: false };
}
render() {
if (this.state.confirming) {
return <div>
View medium-inject.jsx
function inject(deps, Component) {
return class Injector extends React.Component {
render() {
return <Component {...deps} {...this.props} />;
}
};
}
const SafeTodo = inject(Todo, { DeleteTodo: ConfirmButton });
render(<TodoList Todo={SafeTodo} />);