-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby): show multiple invites together & at end where people are…
… more likely to see them (#28450) * fix(gatsby): show multiple invites together & at end where people are more likely to see them * Add telemetry * update copy from suggestions by @DSchau * Actually stop listening * Update packages/gatsby/src/utils/show-experiment-notice.ts Co-authored-by: Matt Kane <[email protected]> * Add test for generating the message * rewrite messages & make shorter * make all the things happy * update flag * This breaking windows?? * Don't use explicit \n to see if that helps snapshot * Maybe jest is fine w/ explicit new-lines 🤷♂️ * Strip ansi for tests * Update packages/gatsby/src/services/initialize.ts Co-authored-by: Michal Piechowiak <[email protected]> * Update packages/gatsby/src/services/run-page-queries.ts Co-authored-by: Michal Piechowiak <[email protected]> * use trackCLI not trackFeatureIsUsed * only store that we showed the invite when we actually do show the invite * Call code directly from webpack's done callback * mock in jest * be more explicit about how the caching behavior changes * Show full code sample per @pelikhan's feedback * typescript fixes * Update packages/gatsby/src/services/initialize.ts Co-authored-by: Michal Piechowiak <[email protected]> * Update packages/gatsby/src/services/initialize.ts Co-authored-by: Matt Kane <[email protected]> Co-authored-by: gatsbybot <[email protected]> Co-authored-by: Michal Piechowiak <[email protected]>
- Loading branch information
1 parent
755950d
commit 7e734cc
Showing
8 changed files
with
113 additions
and
45 deletions.
There are no files selected for viewing
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
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
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
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
11 changes: 11 additions & 0 deletions
11
packages/gatsby/src/utils/__tests__/__snapshots__/show-experiment-notice.js.snap
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`show-experiment-notice generates a message 1`] = ` | ||
" | ||
Hi from the Gatsby maintainers! Based on what we see in your site, these coming | ||
features may help you. All of these can be enabled within gatsby-config.js via | ||
flags (samples below) | ||
The Flag (http://example.com), hi | ||
" | ||
`; |
20 changes: 20 additions & 0 deletions
20
packages/gatsby/src/utils/__tests__/show-experiment-notice.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { createNoticeMessage } from "../show-experiment-notice" | ||
import stripAnsi from "strip-ansi" | ||
|
||
jest.mock(`terminal-link`, () => (text, url) => `${text} (${url})`) | ||
|
||
describe(`show-experiment-notice`, () => { | ||
it(`generates a message`, () => { | ||
expect( | ||
stripAnsi( | ||
createNoticeMessage([ | ||
{ | ||
noticeText: `hi`, | ||
umbrellaLink: `http://example.com`, | ||
experimentIdentifier: `The Flag`, | ||
}, | ||
]) | ||
) | ||
).toMatchSnapshot() | ||
}) | ||
}) |
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
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