File tree 4 files changed +40
-8
lines changed
4 files changed +40
-8
lines changed Original file line number Diff line number Diff line change 1
- import "../dist/validate_notebook .js" ;
1
+ import "../dist/notebooks/index .js" ;
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ if (!pathname) {
69
69
throw new Error ( "No pathname provided." ) ;
70
70
}
71
71
72
- const run = async ( ) => {
72
+ export async function checkNotebookTypeErrors ( ) {
73
73
if ( ! pathname . endsWith ( ".ipynb" ) ) {
74
74
throw new Error ( "Only .ipynb files are supported." ) ;
75
75
}
@@ -130,10 +130,4 @@ const run = async () => {
130
130
// Do nothing
131
131
}
132
132
}
133
- } ;
134
-
135
- try {
136
- void run ( ) ;
137
- } catch {
138
- process . exit ( 1 ) ;
139
133
}
Original file line number Diff line number Diff line change
1
+ import fs from "fs" ;
2
+
3
+ const [ pathname ] = process . argv . slice ( 2 ) ;
4
+
5
+ if ( ! pathname ) {
6
+ throw new Error ( "No pathname provided." ) ;
7
+ }
8
+
9
+ /**
10
+ * tslab will sometimes throw an error inside the output cells of a notebook
11
+ * if the notebook is being rebuilt. This function checks for that error,
12
+ * because we do not want to commit that to our docs.
13
+ */
14
+ export async function checkUnexpectedRebuildError ( ) {
15
+ if ( ! pathname . endsWith ( ".ipynb" ) ) {
16
+ throw new Error ( "Only .ipynb files are supported." ) ;
17
+ }
18
+ const notebookContents = await fs . promises . readFile ( pathname , "utf-8" ) ;
19
+ if (
20
+ notebookContents . includes (
21
+ "UncaughtException: Error: Unexpected pending rebuildTimer"
22
+ )
23
+ ) {
24
+ throw new Error ( `Found unexpected pending rebuildTimer in ${ pathname } ` ) ;
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ import { checkNotebookTypeErrors } from "./check_notebook_type_errors.js" ;
2
+ import { checkUnexpectedRebuildError } from "./check_unexpected_rebuild_timer.js" ;
3
+
4
+ async function main ( ) {
5
+ await Promise . all ( [ checkNotebookTypeErrors ( ) , checkUnexpectedRebuildError ( ) ] ) ;
6
+ }
7
+
8
+ try {
9
+ void main ( ) ;
10
+ } catch {
11
+ process . exit ( 1 ) ;
12
+ }
You can’t perform that action at this time.
0 commit comments