Skip to content

Instantly share code, notes, and snippets.

Nicolas Cuillery ncuillery

Block or report user

Report or block ncuillery

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ncuillery
ncuillery / buddybuild_postbuild.sh
Created Sep 5, 2017
Full code snippets relative to the Medium story
View buddybuild_postbuild.sh
#!/usr/bin/env bash
echo "Run custom test frameworks"
cd ..
# Create the directory expected by buddybuild
mkdir -p buddybuild_artifacts/Jest
mkdir -p buddybuild_artifacts/ESLint
@ncuillery
ncuillery / eslint-output-adapter-3.js
Last active Sep 4, 2017
Medium buddybuild/ESLint
View eslint-output-adapter-3.js
// Global metadata
output.numFailedTestSuites = errors ? 1 : 0;
output.numFailedTests = errors;
output.numPassedTestSuites = errors ? 0 : 1;
output.numPassedTests = eslintReport.length - errors;
output.numTotalTestSuites = 1;
output.numTotalTests = eslintReport.length;
output.success = !errors;
// Test suite metadata
@ncuillery
ncuillery / eslint-output-adapter-2.js
Last active Sep 4, 2017
Medium buddybuild/ESLint
View eslint-output-adapter-2.js
let errors = 0;
eslintReport.forEach(entry => {
errors += entry.errorCount ? 1 : 0; // Count only 1 error in case of multiple errors in the same file
output.testResults[0].assertionResults.push({
status: entry.errorCount ? 'failed' : 'passed',
title: entry.filePath,
failureMessages: entry.messages.map(
// Transform the object-based ESLint message into a Jest-style string:
({ ruleId, message, line, column }) => `Error ${ruleId} at ${line}:${column}: ${message}`,
),
View eslint-output-adapter-1.js
const output = {
testResults: [
{
assertionResults: [],
},
],
};
@ncuillery
ncuillery / eslint.js
Created Sep 4, 2017
Medium buddybuild/ESLint
View eslint.js
[
{
"filePath": "\/Users\/ncuillery\/Dev\/M6\/app-foosby\/src\/stats\/statsActions.js",
"messages": [],
"errorCount": 0,
"warningCount": 0
},
{
"filePath": "\/Users\/ncuillery\/Dev\/M6\/app-foosby\/src\/stats\/statsEpics.js",
"messages": [
@ncuillery
ncuillery / jest.js
Last active Sep 4, 2017
Medium buddybuild/ESLint
View jest.js
{
"numFailedTestSuites": 1,
"numFailedTests": 1,
"numPassedTestSuites": 13,
"numPassedTests": 98,
"numPendingTestSuites": 0,
"numPendingTests": 0,
"numRuntimeErrorTestSuites": 0,
"numTotalTestSuites": 14,
"numTotalTests": 99,
@ncuillery
ncuillery / buddybuild_postbuild.sh
Last active Sep 4, 2017
Medium buddybuild/ESLint
View buddybuild_postbuild.sh
# Using React Native, this file lies in the platform subdirectory
cd ..
# Create the directory expected by buddybuild
mkdir -p buddybuild_artifacts/Jest
# Run Jest command
jest --outputFile=buddybuild_artifacts/Jest/jest.json --json || exit 1
@ncuillery
ncuillery / npm_issue.md
Last active May 29, 2017
Child process is exited prematurely when running a view command
View npm_issue.md

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

When using NPM 5: if I run the npm view command in a child process (either exec or spawn) the child process exits with code 0 right after the reception of the first chunk of data.

@ncuillery
ncuillery / ReactEurope2017_5.js
Last active Jul 16, 2017
ReactEurope2017_5
View ReactEurope2017_5.js
const withLoader = Component => props => {
if (!props.ready) {
return <Loader />;
}
return <Component {...props} />;
}
// Usage in the previous example:
const enhance = compose(
View ReactEurope2017_4.js
// Instead of doing this...
const EnhancedComponent = connect(commentSelector)(withRouter(WrappedComponent))
// ... you can use a function composition utility
// compose(f, g, h) is the same as (...args) => f(g(h(...args)))
const enhance = compose(
// These are both single-argument HOCs
connect(commentSelector),
withRouter
)
You can’t perform that action at this time.