Skip to content

Commit

Permalink
Add instrumentation to netlify build
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarvarela committed Dec 29, 2023
1 parent 163222e commit aa8319e
Show file tree
Hide file tree
Showing 8 changed files with 953 additions and 93 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
runTests: false
install-command: npm ci

- name: Use new netlify.toml
- name: Use tests specific netlify.toml
run: |
rm -f netlify.toml
mv github-netlify.toml netlify.toml
mv tests-netlify.toml netlify.toml
working-directory: site/gatsby-site

- name: Install Netlify CLI
Expand All @@ -49,6 +49,7 @@ jobs:
run: netlify build --context deploy-preview
working-directory: site/gatsby-site
env:
INSTRUMENT: true
NETLIFY_SITE_ID: ${{ vars.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
38 changes: 38 additions & 0 deletions site/gatsby-site/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = function (api) {
api.cache(true);

const config = {
plugins: [
[
"@babel/plugin-proposal-decorators",
{
legacy: true
}
],
],
presets: [
[
"babel-preset-gatsby",
{
targets: {
browsers: [">0.25%", "not dead"]
}
}
],
],
};

if (process.env.INSTRUMENT) {

config.plugins.push([
"babel-plugin-istanbul",
{
"include": [
"src/**/*.js"
]
}
]);
}

return config;
};
6 changes: 5 additions & 1 deletion site/gatsby-site/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ module.exports = defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config);
require('@cypress/code-coverage/task')(on, config);

require('./cypress/plugins/index.js')(on, config);

return config;
},
baseUrl: 'http://localhost:8000/',
},
Expand Down
2 changes: 2 additions & 0 deletions site/gatsby-site/cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// https://on.cypress.io/configuration
// ***********************************************************

import '@cypress/code-coverage/support';

// Import commands.js using ES2015 syntax:
import './commands';

Expand Down
6 changes: 0 additions & 6 deletions site/gatsby-site/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ exports.onCreateWebpackConfig = ({ actions }) => {
});
};

exports.onCreateBabelConfig = ({ actions }) => {
actions.setBabelPlugin({
name: '@babel/plugin-proposal-export-default-from',
});
};

exports.onCreateNode = async ({ node, getNode, actions }) => {
const { createNodeField } = actions;

Expand Down
Loading

0 comments on commit aa8319e

Please sign in to comment.